You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Scott Jorgenson <ds...@yahoo.com> on 2008/06/13 23:27:28 UTC

[users@httpd] ProxyPassReverse problem inside -- is there a fix?

Greetings, everyone.

In February 2005 Nick Kew pointed out a problem with mod_proxy's ProxyPassReverse directive: though contained inside a <Location> section, ProxyPassReverse would still be applied at the server level.  Here's a link to an archive of that discussion: http://tech.groups.yahoo.com/group/new-httpd/message/52311

My question is, did this ever get fixed, and if so, in which Apache httpd  version?  I've looked in the change logs for 2.0 and 2.2 (here http://www.apache.org/dist/httpd/CHANGES_2.0 and here http://www.apache.org/dist/httpd/CHANGES_2.2) and can't find any mention of this issue.  I am using 2.0.59 which is still exhibiting the problem, and I'm trying to find a fix.

Thanks in advance,

Scott


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Scott Jorgenson <ds...@yahoo.com>.
Hi Nick and everybody,

I'm still having the same issue I reported here several days ago.  ProxyPassReverse inside <Location> isn't working as expected in Apache 2.0.59.  Here is my mod_proxy configuration in its entirety.
 
ProxyRequests Off
ProxyPass /abc http://<target-hostname>/cgi-bin
ProxyPass /def http://<target-hostname>/cgi-bin
<Location /abc>
    ProxyPassReverse http://<target-hostname>/cgi-bin
</Location>
<Location /def>
    ProxyPassReverse http://<target-hostname>/cgi-bin
</Location>

The problem is that only the first ProxyPassReverse has any effect.  When the <target-hostname> sends a 302 redirect in response to a request made to this reverse-proxy, the Location URL always gets rewritten to the /abc path (ie the path used in the first <Location>, ProxyPass and ProxyPassReverse), even if the request was using the /def path (ie the path used in the second ones).

For example, when my browser opens this URL (note Apache is SSL-enabled so its an https URL):

https://<proxy-hostname>/def/redirector.cgi

...and the redirector.cgi sends a Location with this in it:

http://<target-hostname/cgi-bin/whatever

...then my browser gets erroneously redirected by mod_proxy to:

https://<proxy-hostname>/abc/whatever

...when of course I would have expected it, and need it, to go to:

https://<proxy-hostname>/def/whatever

Any final ideas?

Thanks again,

Scott

PS.  As I advised before, it seems to be the same problem as was discussed back in February 2005 (see http://tech.groups.yahoo.com/group/new-httpd/message/52311 and follow the link to Neil Hillard's problem report contained therein).  It seems as if the fix proposed at that time did not get implemented, did not work, or at least did not make it into this version of Apache (2.0.59).


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Scott Jorgenson <ds...@yahoo.com>.
Resending.  The gdccideas URL was meant to be the same as the <target-hostname> URL in my configuration given in my previous email.  Now I've normalized that to <target-hostname> below.  Sorry for the poor editing skills :-)

Scott

--- On Tue, 6/17/08, Scott Jorgenson <ds...@yahoo.com> wrote:

> Hi Nick,
> 
> Thanks for the help!
> 
> Sorry for the abbreviated configuration.  Here is my
> mod_proxy configuration in its entirety (only the hostnames
> in the URLs are changed).  Note that I also moved the
> ProxyPass outside of the <Location> section, at your
> suggestion (before that, I had each ProxyPass inside the
> <Location> for its respective path, omitting the path
> argument on ProxyPass accordingly).  Unfortunately that
> rearrangement didn't fix the situation.
> 
> ProxyRequests Off
> ProxyPass /abc http://<target-hostname>/cgi-bin
> ProxyPass /def http://<target-hostname>/cgi-bin
> <Location /abc>
>     ProxyPassReverse http://<target-hostname>/cgi-bin
> </Location>
> <Location /def>
>     ProxyPassReverse http://<target-hostname>/cgi-bin
> </Location>
> 
> Note also that on the <target-hostname> there is a
> CGI script, test.pl, which just redirects to
> http://<target-hostname>/cgi-bin/end.pl.
> 
> Now, the persistent problem is that when I make the
> following request to the proxy in my browser:
> 
> https://<proxy-hostname>/def/test.pl
> 
> (yes, the proxy is SSL-enabled but the target is not) I get
> the following redirect from the proxy:
> 
> Location: https://<proxy-hostname>/abc/end.pl
> 
> Notice how a request into the /def location ended-up
> getting redirected into the /abc location.  That's the
> problem.  Conversely, requests into /abc/test.pl get
> redirected to /abc/end.pl as they should.
> 
> Interestingly, if I reverse the 2 <Location>
> sections, it is the opposite behavior -- requests into
> either location for test.pl then redirect to /def/end.pl. 
> In other words, it seems to be the first ProxyPassReverse
> listed in the configuration which takes effect, regardless
> of the fact that each should be scoped just to a
> <Location>.
> 
> It seems the same problem as you discussed back in February
> 2005 (see
> http://tech.groups.yahoo.com/group/new-httpd/message/52311
> and follow the link to Neil Hillard's problem report
> contained therein).
> 
> I am using Apache 2.0.59.
> 
> Please advise, and thanks very much in advance!
> 
> Scott
> 
> --- On Tue, 6/17/08, Nick Kew <ni...@webthing.com>
> wrote:
> 
> > From: Nick Kew <ni...@webthing.com>
> > Subject: Re: [users@httpd] ProxyPassReverse problem
> inside <Location> -- is there a fix?
> > To: users@httpd.apache.org
> > Date: Tuesday, June 17, 2008, 3:00 PM
> > On Tue, 17 Jun 2008 13:43:53 -0700 (PDT)
> > Scott Jorgenson <ds...@yahoo.com>
> wrote:
> > 
> > > To recap, it seems the fix for ProxyPassReverse
> inside
> > <Location> is
> > > not working (at least, in Apache 2.0.59). 
> Details are
> > below.  Does
> > > anyone have any information otherwise, or shall I
> > submit a bug
> > > report?  (And if you've gotten it to work,
> I'd
> > appreciate your
> > > pointing-out what is wrong with my configuration.
> 
> > Thanks in advance!)
> > 
> > Whoa!
> > 
> > Looking at your config, you have ProxyPass inside
> > <Location> too.
> > I think *that* won't work, for exactly the same
> reason
> > as reported
> > originally for ProxyPassReverse.  IIRC It wasn't
> an
> > issue, because
> > ProxyPass wasn't even valid in <Location>. 
> If it
> > is now, that's
> > worth a bugzilla entry.
> > 
> > But your config appears too paraphrased to diagnose.
> > 
> > 
> > -- 
> > Nick Kew
> > 
> > Application Development with Apache - the Apache
> Modules
> > Book
> > http://www.apachetutor.org/
> > 
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache
> HTTP
> > Server Project.
> > See <URL:http://httpd.apache.org/userslist.html>
> for
> > more info.
> > To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
> >    "   from the digest:
> > users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail:
> > users-help@httpd.apache.org
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Scott Jorgenson <ds...@yahoo.com>.
Hi Nick,

Thanks for the help!

Sorry for the abbreviated configuration.  Here is my mod_proxy configuration in its entirety (only the hostnames in the URLs are changed).  Note that I also moved the ProxyPass outside of the <Location> section, at your suggestion (before that, I had each ProxyPass inside the <Location> for its respective path, omitting the path argument on ProxyPass accordingly).  Unfortunately that rearrangement didn't fix the situation.

ProxyRequests Off
ProxyPass /abc http://gdccideas.chn.hp.com/cgi-bin
ProxyPass /def http://gdccideas.chn.hp.com/cgi-bin
<Location /abc>
    ProxyPassReverse http://<target-hostname>/cgi-bin
</Location>
<Location /def>
    ProxyPassReverse http://<target-hostname>/cgi-bin
</Location>

Note also that on the <target-hostname> there is a CGI script, test.pl, which just redirects to http://<target-hostname>/cgi-bin/end.pl.

Now, the persistent problem is that when I make the following request to the proxy in my browser:

https://<proxy-hostname>/def/test.pl

(yes, the proxy is SSL-enabled but the target is not) I get the following redirect from the proxy:

Location: https://<proxy-hostname>/abc/end.pl

Notice how a request into the /def location ended-up getting redirected into the /abc location.  That's the problem.  Conversely, requests into /abc/test.pl get redirected to /abc/end.pl as they should.

Interestingly, if I reverse the 2 <Location> sections, it is the opposite behavior -- requests into either location for test.pl then redirect to /def/end.pl.  In other words, it seems to be the first ProxyPassReverse listed in the configuration which takes effect, regardless of the fact that each should be scoped just to a <Location>.

It seems the same problem as you discussed back in February 2005 (see http://tech.groups.yahoo.com/group/new-httpd/message/52311 and follow the link to Neil Hillard's problem report contained therein).

I am using Apache 2.0.59.

Please advise, and thanks very much in advance!

Scott

--- On Tue, 6/17/08, Nick Kew <ni...@webthing.com> wrote:

> From: Nick Kew <ni...@webthing.com>
> Subject: Re: [users@httpd] ProxyPassReverse problem inside <Location> -- is there a fix?
> To: users@httpd.apache.org
> Date: Tuesday, June 17, 2008, 3:00 PM
> On Tue, 17 Jun 2008 13:43:53 -0700 (PDT)
> Scott Jorgenson <ds...@yahoo.com> wrote:
> 
> > To recap, it seems the fix for ProxyPassReverse inside
> <Location> is
> > not working (at least, in Apache 2.0.59).  Details are
> below.  Does
> > anyone have any information otherwise, or shall I
> submit a bug
> > report?  (And if you've gotten it to work, I'd
> appreciate your
> > pointing-out what is wrong with my configuration. 
> Thanks in advance!)
> 
> Whoa!
> 
> Looking at your config, you have ProxyPass inside
> <Location> too.
> I think *that* won't work, for exactly the same reason
> as reported
> originally for ProxyPassReverse.  IIRC It wasn't an
> issue, because
> ProxyPass wasn't even valid in <Location>.  If it
> is now, that's
> worth a bugzilla entry.
> 
> But your config appears too paraphrased to diagnose.
> 
> 
> -- 
> Nick Kew
> 
> Application Development with Apache - the Apache Modules
> Book
> http://www.apachetutor.org/
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 17 Jun 2008 13:43:53 -0700 (PDT)
Scott Jorgenson <ds...@yahoo.com> wrote:

> To recap, it seems the fix for ProxyPassReverse inside <Location> is
> not working (at least, in Apache 2.0.59).  Details are below.  Does
> anyone have any information otherwise, or shall I submit a bug
> report?  (And if you've gotten it to work, I'd appreciate your
> pointing-out what is wrong with my configuration.  Thanks in advance!)

Whoa!

Looking at your config, you have ProxyPass inside <Location> too.
I think *that* won't work, for exactly the same reason as reported
originally for ProxyPassReverse.  IIRC It wasn't an issue, because
ProxyPass wasn't even valid in <Location>.  If it is now, that's
worth a bugzilla entry.

But your config appears too paraphrased to diagnose.


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Scott Jorgenson <ds...@yahoo.com>.
To recap, it seems the fix for ProxyPassReverse inside <Location> is not working (at least, in Apache 2.0.59).  Details are below.  Does anyone have any information otherwise, or shall I submit a bug report?  (And if you've gotten it to work, I'd appreciate your pointing-out what is wrong with my configuration.  Thanks in advance!)

Scott

--- On Fri, 6/13/08, Scott Jorgenson <ds...@yahoo.com> wrote:

> From: Scott Jorgenson <ds...@yahoo.com>
> Subject: Re: [users@httpd] ProxyPassReverse problem inside <Location> -- is there a fix?
> To: users@httpd.apache.org
> Date: Friday, June 13, 2008, 5:00 PM
> Thanks for the info, Nick.
> 
> Strangely, I'm using 2.0.59 and am quite sure I'm
> encountering exactly that old problem.  My configuration is
> like this:
> 
> <Location /abc>
>     ProxyPass http://my-server.example.com/some-path
>     ProxyPassReverse http://my-server.example.com/some-path
> </Location>
> <Location /def>
>     ProxyPass http://my-server.example.com/some-path
>     ProxyPassReverse http://my-server.example.com/some-path
> </Location>
> 
> When my browser requests
> http://my-proxy.example.com/abc/something, mod_proxy passes
> this through to my-server as expected; and when my-server
> redirects to
> http://my-server.example.com/some-path/something-else, my
> browser gets redirected to
> http://my-proxy.example.com/abc/something-else.  Good so
> far.  But when I repeat the same scenario, with my browser
> instead requesting the /def location
> (http://my-proxy.example.com/def/something), it still gets
> redirected to the /abc location
> (http://my-proxy.example.com/abc/something-else) instead of
> the /def location.  So it seems to be exactly what was being
> described in that original problem report.
> 
> Is there something I needed to do in the configuration, to
> enable that fix?  If you have any ideas, I would very much
> appreciate it :-)  !
> 
> Scott
> 
> --- On Fri, 6/13/08, Nick Kew <ni...@webthing.com>
> wrote:
> 
> > From: Nick Kew <ni...@webthing.com>
> > Subject: Re: [users@httpd] ProxyPassReverse problem
> inside <Location> -- is there a fix?
> > To: users@httpd.apache.org
> > Date: Friday, June 13, 2008, 3:47 PM
> > On Fri, 13 Jun 2008 14:27:28 -0700 (PDT)
> > Scott Jorgenson <ds...@yahoo.com>
> wrote:
> > 
> > > Greetings, everyone.
> > > 
> > > In February 2005 Nick Kew pointed out a problem
> with
> > mod_proxy's
> > > ProxyPassReverse directive: though contained
> inside a
> > <Location>
> > > section, ProxyPassReverse would still be applied
> at
> > the server
> > > level.  Here's a link to an archive of that
> > discussion:
> > >
> >
> http://tech.groups.yahoo.com/group/new-httpd/message/52311
> > > 
> > > My question is, did this ever get fixed, and if
> so, in
> > which Apache
> > > httpd  version?  I've looked in the change
> logs
> > for 2.0 and 2.2 (here
> > 
> > It got fixed long ago (2004 IIRC).  Can't
> recollect
> > what version.
> > 
> > -- 
> > Nick Kew
> > 
> > Application Development with Apache - the Apache
> Modules
> > Book
> > http://www.apachetutor.org/
> > 
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache
> HTTP
> > Server Project.
> > See <URL:http://httpd.apache.org/userslist.html>
> for
> > more info.
> > To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
> >    "   from the digest:
> > users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail:
> > users-help@httpd.apache.org
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Scott Jorgenson <ds...@yahoo.com>.
Thanks for the info, Nick.

Strangely, I'm using 2.0.59 and am quite sure I'm encountering exactly that old problem.  My configuration is like this:

<Location /abc>
    ProxyPass http://my-server.example.com/some-path
    ProxyPassReverse http://my-server.example.com/some-path
</Location>
<Location /def>
    ProxyPass http://my-server.example.com/some-path
    ProxyPassReverse http://my-server.example.com/some-path
</Location>

When my browser requests http://my-proxy.example.com/abc/something, mod_proxy passes this through to my-server as expected; and when my-server redirects to http://my-server.example.com/some-path/something-else, my browser gets redirected to http://my-proxy.example.com/abc/something-else.  Good so far.  But when I repeat the same scenario, with my browser instead requesting the /def location (http://my-proxy.example.com/def/something), it still gets redirected to the /abc location (http://my-proxy.example.com/abc/something-else) instead of the /def location.  So it seems to be exactly what was being described in that original problem report.

Is there something I needed to do in the configuration, to enable that fix?  If you have any ideas, I would very much appreciate it :-)  !

Scott

--- On Fri, 6/13/08, Nick Kew <ni...@webthing.com> wrote:

> From: Nick Kew <ni...@webthing.com>
> Subject: Re: [users@httpd] ProxyPassReverse problem inside <Location> -- is there a fix?
> To: users@httpd.apache.org
> Date: Friday, June 13, 2008, 3:47 PM
> On Fri, 13 Jun 2008 14:27:28 -0700 (PDT)
> Scott Jorgenson <ds...@yahoo.com> wrote:
> 
> > Greetings, everyone.
> > 
> > In February 2005 Nick Kew pointed out a problem with
> mod_proxy's
> > ProxyPassReverse directive: though contained inside a
> <Location>
> > section, ProxyPassReverse would still be applied at
> the server
> > level.  Here's a link to an archive of that
> discussion:
> >
> http://tech.groups.yahoo.com/group/new-httpd/message/52311
> > 
> > My question is, did this ever get fixed, and if so, in
> which Apache
> > httpd  version?  I've looked in the change logs
> for 2.0 and 2.2 (here
> 
> It got fixed long ago (2004 IIRC).  Can't recollect
> what version.
> 
> -- 
> Nick Kew
> 
> Application Development with Apache - the Apache Modules
> Book
> http://www.apachetutor.org/
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ProxyPassReverse problem inside -- is there a fix?

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 13 Jun 2008 14:27:28 -0700 (PDT)
Scott Jorgenson <ds...@yahoo.com> wrote:

> Greetings, everyone.
> 
> In February 2005 Nick Kew pointed out a problem with mod_proxy's
> ProxyPassReverse directive: though contained inside a <Location>
> section, ProxyPassReverse would still be applied at the server
> level.  Here's a link to an archive of that discussion:
> http://tech.groups.yahoo.com/group/new-httpd/message/52311
> 
> My question is, did this ever get fixed, and if so, in which Apache
> httpd  version?  I've looked in the change logs for 2.0 and 2.2 (here

It got fixed long ago (2004 IIRC).  Can't recollect what version.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org