From 9441c91d97a02034b2f2cfa9b19e3a555dbee317 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 21 Mar 2018 23:17:12 -0400 Subject: Bug 1399713 - ensure existing production redirects work in a cloud hosted environment --- helper.psgi | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 helper.psgi (limited to 'helper.psgi') 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 -- cgit v1.2.3-24-g4f1b