On 11/10/12 00:34, Stephen Shorrock wrote:
I'm trying to run an application behind a frontend proxy where the
path at the front end is not route:

config on frontend.mydomain.ac.uk

<Location /CUFSE>
         RewriteEngine On
         RewriteCond %{REMOTE_USER} (.+)
         RewriteRule . - [E=RU:%1]
         RequestHeader set REMOTE_USER %{RU}e
         RequestHeader set X-Forwarded-Path '/CUFSE'
         ProxyPass http://backend.mydomain.ac.uk:5000/
         ProxyPassReverse http://backend.mydomain.ac.uk:5000/

On the backend my application is run via starman and has contained in
its configuration:

     name => 'CUFSE',
     using_frontend_proxy => 1,

I would there for expect that when calling $c->uri_for('some/path') I would get:


but the frontend portion of the path is not there instead I only have:


I've attempted to grep all Perl modules for /X[_-]Forwarded[_-]Path/i
but with no joy.
(source of method:

A belated plug for Plack::Middleware::ReverseProxyPath (although it
sounds like your problem is solved).


I've not tried using this with Catalyst, but it's PSGI middleware so
should be fine.

I use the following header names:

    The front-end prefix being forwarded FROM. This is the replacement.
    The value of SCRIPT_NAME on the front-end.

    The back-end prefix being forwarded TO. This is to be replaced.
    This is the part of the back-end URI that is just plumbing which
    should be hidden from the app.

X-Forwarded-Script-Name follows the X-Forwarded-* pattern established
by other headers (the SCRIPT_NAME on the front end) and matches PSGI names.
X-Traversal-Path was inspired by a similar Python/wsgi middleware.

However, I'd like to use the defacto standard names, if they exist.
Is X-Forwarded-Path in common use?

I might also add support for X-Request-Base and a combined middleware
similar to Catalyst::TraitFor::Request::ProxyBase, thanks for the


List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to