summaryrefslogtreecommitdiffstats
path: root/helper.psgi
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-22 04:17:12 +0100
committerGitHub <noreply@github.com>2018-03-22 04:17:12 +0100
commit9441c91d97a02034b2f2cfa9b19e3a555dbee317 (patch)
tree4739a605b5961a2737301c81695ef939b5f00b3d /helper.psgi
parent9356ed8882760e0b724db963a0dff8f8d1943450 (diff)
downloadbugzilla-9441c91d97a02034b2f2cfa9b19e3a555dbee317.tar.gz
bugzilla-9441c91d97a02034b2f2cfa9b19e3a555dbee317.tar.xz
Bug 1399713 - ensure existing production redirects work in a cloud hosted environment
Diffstat (limited to 'helper.psgi')
-rw-r--r--helper.psgi35
1 files changed, 35 insertions, 0 deletions
diff --git a/helper.psgi b/helper.psgi
new file mode 100644
index 000000000..cc8c648a8
--- /dev/null
+++ b/helper.psgi
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+use 5.10.1;
+use strict;
+use warnings;
+use Plack::Request;
+use Plack::Response;
+
+my $app = sub {
+ my $env = shift;
+ my $req = Plack::Request->new($env);
+ my $res = Plack::Response->new(404);
+ my $urlbase = Bugzilla->localconfig->{urlbase};
+ my $path = $req->path;
+
+ if ( $path eq '/quicksearch.html' ) {
+ $res->redirect( $urlbase . 'page.cgi?id=quicksearch.html', 301 );
+ }
+ elsif ( $path eq '/bugwritinghelp.html') {
+ $res->redirect( $urlbase . 'page.cgi?id=bug-writing.html', 301 );
+ }
+ elsif ( $path =~ m{^/(\d+)$}s ) {
+ $res->redirect( $urlbase . "show_bug.cgi?id=$1", 301 );
+ }
+ else {
+ $res->body('not found');
+ }
+ return $res->finalize;
+}; \ No newline at end of file