Re: [Catalyst] X-Forwarded-Path

2012-11-11 Thread Brad Bowman

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/
/Location

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

__PACKAGE__-config(
 name = 'CUFSE',
 using_frontend_proxy = 1,
 ...

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

http://frontend.mydomain.ac.uk/CUFSE/some/path

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

http://frontend.mydomain.ac.uk/some/path

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

[..]

(source of method:
http://wiki.catalystframework.org/wiki/wikicookbook/frontendproxy)



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

http://search.cpan.org/~bowmanbs/Plack-Middleware-ReverseProxyPath-0.03/lib/Plack/Middleware/ReverseProxyPath.pm

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

I use the following header names:

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

X-Traversal-Path
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
inspiration.

Brad



___
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/


Re: [Catalyst] X-Forwarded-Path

2012-10-11 Thread Stephen Shorrock
Thanks t0m,

I installed your module and it works great - thanks for writing etc.

I guess what I may have been pertaining to is that X-Forwarded-Path
using_frontend_proxy doesn't seem to be implemented although on the
'official'? wiki
(http://wiki.catalystframework.org/wiki/wikicookbook/frontendproxy) it
is documented.

Best wishes
Stephen

On Wed, Oct 10, 2012 at 5:41 PM, Tomas Doran bobtf...@bobtfish.net wrote:
 You're not doing anything wrong - there just isn't a common spec for doing 
 this..

 You probably want to be using Catalyst::TraitFor::Request::ProxyBase, which I 
 wrote specifically for this use-case however :)

 Cheers
 t0m

 On 10 Oct 2012, at 14:34, Stephen Shorrock wrote:

 Hi,

 Catalyst 5.90011

 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/
 /Location

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

 __PACKAGE__-config(
   name = 'CUFSE',
   using_frontend_proxy = 1,
   ...

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

 http://frontend.mydomain.ac.uk/CUFSE/some/path

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

 http://frontend.mydomain.ac.uk/some/path

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

 Is the passing of the path supported or am I doing something incorrectly

 (source of method:
 http://wiki.catalystframework.org/wiki/wikicookbook/frontendproxy)

 Thanks in advance

 Stephen

 ___
 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/


___
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/


AW: [Catalyst] X-Forwarded-Path

2012-10-10 Thread Trzeciak, Rainer
Hi Stephan,
what about
ProxyPass http://backend.mydomain.ac.uk:5000/CUFSE (please note the /CUFSE at 
the end) ?
You can then skip: RequestHeader set X-Forwarded-Path '/CUFSE'

Kind regards,
Rainer
 

-Ursprüngliche Nachricht-
Von: Stephen Shorrock [mailto:stephen.shorr...@gmail.com] 
Gesendet: Mittwoch, 10. Oktober 2012 15:35
An: Catalyst@lists.scsys.co.uk
Betreff: [Catalyst] X-Forwarded-Path

Hi,

Catalyst 5.90011

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/
/Location

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

__PACKAGE__-config(
name = 'CUFSE',
using_frontend_proxy = 1,
...

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

http://frontend.mydomain.ac.uk/CUFSE/some/path

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

http://frontend.mydomain.ac.uk/some/path

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

Is the passing of the path supported or am I doing something incorrectly

(source of method:
http://wiki.catalystframework.org/wiki/wikicookbook/frontendproxy)

Thanks in advance

Stephen

___
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/

Diese Nachricht einschliesslich etwa beigefuegter Anhaenge ist vertraulich und 
kann dem Bank- und Datengeheimnis unterliegen oder sonst rechtlich geschuetzte 
Daten und Informationen enthalten. Wenn Sie nicht der richtige Adressat sind 
oder diese Nachricht irrtuemlich erhalten haben, informieren Sie bitte sofort 
den Absender über die Antwortfunktion. Anschliessend moechten Sie bitte diese 
Nachricht einschliesslich etwa beigefuegter Anhaenge unverzueglich vollstaendig 
loeschen. Das unerlaubte Kopieren oder Speichern dieser Nachricht und/oder der 
ihr etwa beigefuegten Anhaenge sowie die unbefugte Weitergabe der darin 
enthaltenen Daten und Informationen sind nicht gestattet. Wir weisen darauf 
hin, dass rechtsverbindliche Erklaerungen namens unseres Hauses grundsaetzlich 
der Unterschriften zweier ausreichend bevollmaechtigter Vertreter unseres 
Hauses beduerfen. Wir verschicken daher keine rechtsverbindlichen Erklaerungen 
per E-Mail an Dritte. Demgemaess nehmen wir per E-Mail auch keine 
rechtsverbindlichen Erklaerungen oder Auftraege von Dritten entgegen. 
Sollten Sie Schwierigkeiten beim Oeffnen dieser E-Mail haben, wenden Sie sich 
bitte an den Absender oder an i...@berenberg.de. Please refer to 
http://www.berenberg.de/my_berenberg/disclaimer_e.html for our confidentiality 
notice.


___
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/


Re: [Catalyst] X-Forwarded-Path

2012-10-10 Thread Tomas Doran
You're not doing anything wrong - there just isn't a common spec for doing 
this..

You probably want to be using Catalyst::TraitFor::Request::ProxyBase, which I 
wrote specifically for this use-case however :)

Cheers
t0m

On 10 Oct 2012, at 14:34, Stephen Shorrock wrote:

 Hi,
 
 Catalyst 5.90011
 
 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/
 /Location
 
 On the backend my application is run via starman and has contained in
 its configuration:
 
 __PACKAGE__-config(
   name = 'CUFSE',
   using_frontend_proxy = 1,
   ...
 
 I would there for expect that when calling $c-uri_for('some/path') I would 
 get:
 
 http://frontend.mydomain.ac.uk/CUFSE/some/path
 
 but the frontend portion of the path is not there instead I only have:
 
 http://frontend.mydomain.ac.uk/some/path
 
 I've attempted to grep all Perl modules for /X[_-]Forwarded[_-]Path/i
 but with no joy.
 
 Is the passing of the path supported or am I doing something incorrectly
 
 (source of method:
 http://wiki.catalystframework.org/wiki/wikicookbook/frontendproxy)
 
 Thanks in advance
 
 Stephen
 
 ___
 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/


___
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/