You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Loic Paturel <gu...@gmail.com> on 2013/04/09 17:14:59 UTC

[users@httpd] Currently facing some reverse proxy issues

Hello there,

I'll try to explain my issue as clearly as possible.
My architecture looks like this :
some web space <---> outside server (apache server) <---> application server

I've defined a VirtualHost on some outside server ip:port and then some
location inside this VHost. This configuration hosts 2 different locations
to be redirected on 2 different applciations on the application server
(App1 and App2). Both application are 2 different versions on the same
basis.
I'd like to be able to redirect the following addresses towards the 2
applications according to their versions, such as :
https://ip:port/version_App1/subdirectory
https://ip:port/version_App2/subdirectory

In order to do this, I've created 2 Location such as following :
ProxyPreserveHost on
<Location /version_App1/subdirectory>
    ProxyPass http://ipAppServer:port1/subdirectory
    ProxyPassReverse http://ipAppServer:port1/subdirectory
</Location>
<Location /version_App2/subdirectory>
    ProxyPass http://ipAppServer:port2/subdirectory
    ProxyPassReverse http://ipAppServer:port2/subdirectory
</Location>

My issue concerns the response I receive from the application server which
always answers with a redirection but omit the version in the response. It
answers me as following :
https://ip:port
/subdirectory/common/loginView.do;jsessionid=C3E6707A5BA4FD393B5E22525F4D764B
whereas I expect  :
https://ip:port
/version/subdirectory/common/loginView.do;jsessionid=C3E6707A5BA4FD393B5E22525F4D764B

Could someone help me with the rewriting of the response from the
application server, to be able to keep the version inside the url I get as
answer from the server and which is viewed by the user ?

I hope that I've been clear enough and that this has an easy solution. I've
read some topic that I think are related to this, but no solution fit to my
issue.
Thanks in advance.
Loic

Re: [users@httpd] Currently facing some reverse proxy issues

Posted by Loic Paturel <gu...@gmail.com>.
Hi Daniel,
This is the trail I was following lately. After some lookups on the traffic
with an HTTP debugger, it turns out that you were right about the string
substitution. I've managed to change some things on the application and it
now works out as it is supposed to do ;-)

Thanks for your help and Philip's for taking some time about this !!

Loic

Re: [users@httpd] Currently facing some reverse proxy issues

Posted by Daniel Ruggeri <DR...@primary.net>.
On 4/10/2013 7:25 AM, Loic Paturel wrote:
> Hi,
> thanks for your answer.
> I've tried to put both directives outside my <Location> tags but the
> behavior is still the same with this configuration.
> At that time, I've to choose whether I configure version1 or version2
> inside apache but I can't reach both without re-configuring it.
>
> The link you're providing was the stuff I've first looked at but it
> seems that the utilization I want is a particular case...
>
> Loic

Hi, Loic;
   Are you sure that you are getting a redirect and not a sneaky meta
refresh or javascript window.location change? Remember, ProxyPassReverse
is a simple string substitution on the Location header. You may want to
use an HTTP debugger (Fiddler2, TamperData, etc) or mod_dumpio to see
the exact Location header coming from the backend if you are certain it
is a redirect. From there, just adjust the ProxyPassReverse line to
match what is coming back in Location.

--
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Currently facing some reverse proxy issues

Posted by Loic Paturel <gu...@gmail.com>.
Hi,
thanks for your answer.
I've tried to put both directives outside my <Location> tags but the
behavior is still the same with this configuration.
At that time, I've to choose whether I configure version1 or version2
inside apache but I can't reach both without re-configuring it.

The link you're providing was the stuff I've first looked at but it seems
that the utilization I want is a particular case...

Loic


2013/4/10 Philip Wigg <ph...@philipwigg.co.uk>

> Try removing your ProxyPass and ProxyPassReverse directives from inside
> <Location> directives and just put them directly inside your <VirtualHost>
>
> Then use them as detailed in the docs:-
>
> http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass
>
> i.e. something like:-
>
> ProxyPass /version_App1/subdirectory http://ipAppServer:port1/subdirectory
> ProxyPassReverse /version_App1/subdirectory http://ipAppServer:port1
> /subdirectory
>
> ProxyPass /version_App2/subdirectory http://ipAppServer:port2/subdirectory
> ProxyPassReverse /version_App2/subdirectory http://ipAppServer:port2
> /subdirectory
>
> Phil.
>
>
> On 9 April 2013 16:14, Loic Paturel <gu...@gmail.com> wrote:
>
>> Hello there,
>>
>> I'll try to explain my issue as clearly as possible.
>> My architecture looks like this :
>> some web space <---> outside server (apache server) <---> application
>> server
>>
>> I've defined a VirtualHost on some outside server ip:port and then some
>> location inside this VHost. This configuration hosts 2 different locations
>> to be redirected on 2 different applciations on the application server
>> (App1 and App2). Both application are 2 different versions on the same
>> basis.
>> I'd like to be able to redirect the following addresses towards the 2
>> applications according to their versions, such as :
>> https://ip:port/version_App1/subdirectory
>> https://ip:port/version_App2/subdirectory
>>
>> In order to do this, I've created 2 Location such as following :
>> ProxyPreserveHost on
>> <Location /version_App1/subdirectory>
>>     ProxyPass http://ipAppServer:port1/subdirectory
>>     ProxyPassReverse http://ipAppServer:port1/subdirectory
>> </Location>
>> <Location /version_App2/subdirectory>
>>     ProxyPass http://ipAppServer:port2/subdirectory
>>     ProxyPassReverse http://ipAppServer:port2/subdirectory
>> </Location>
>>
>> My issue concerns the response I receive from the application server
>> which always answers with a redirection but omit the version in the
>> response. It answers me as following :
>> https://ip:port
>> /subdirectory/common/loginView.do;jsessionid=C3E6707A5BA4FD393B5E22525F4D764B
>> whereas I expect  :
>> https://ip:port
>> /version/subdirectory/common/loginView.do;jsessionid=C3E6707A5BA4FD393B5E22525F4D764B
>>
>> Could someone help me with the rewriting of the response from the
>> application server, to be able to keep the version inside the url I get as
>> answer from the server and which is viewed by the user ?
>>
>> I hope that I've been clear enough and that this has an easy solution.
>> I've read some topic that I think are related to this, but no solution fit
>> to my issue.
>> Thanks in advance.
>>  Loic
>>
>
>

Re: [users@httpd] Currently facing some reverse proxy issues

Posted by Philip Wigg <ph...@philipwigg.co.uk>.
Try removing your ProxyPass and ProxyPassReverse directives from inside
<Location> directives and just put them directly inside your <VirtualHost>

Then use them as detailed in the docs:-

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass

i.e. something like:-

ProxyPass /version_App1/subdirectory http://ipAppServer:port1/subdirectory
ProxyPassReverse /version_App1/subdirectory http://ipAppServer:port1
/subdirectory

ProxyPass /version_App2/subdirectory http://ipAppServer:port2/subdirectory
ProxyPassReverse /version_App2/subdirectory http://ipAppServer:port2
/subdirectory

Phil.


On 9 April 2013 16:14, Loic Paturel <gu...@gmail.com> wrote:

> Hello there,
>
> I'll try to explain my issue as clearly as possible.
> My architecture looks like this :
> some web space <---> outside server (apache server) <---> application
> server
>
> I've defined a VirtualHost on some outside server ip:port and then some
> location inside this VHost. This configuration hosts 2 different locations
> to be redirected on 2 different applciations on the application server
> (App1 and App2). Both application are 2 different versions on the same
> basis.
> I'd like to be able to redirect the following addresses towards the 2
> applications according to their versions, such as :
> https://ip:port/version_App1/subdirectory
> https://ip:port/version_App2/subdirectory
>
> In order to do this, I've created 2 Location such as following :
> ProxyPreserveHost on
> <Location /version_App1/subdirectory>
>     ProxyPass http://ipAppServer:port1/subdirectory
>     ProxyPassReverse http://ipAppServer:port1/subdirectory
> </Location>
> <Location /version_App2/subdirectory>
>     ProxyPass http://ipAppServer:port2/subdirectory
>     ProxyPassReverse http://ipAppServer:port2/subdirectory
> </Location>
>
> My issue concerns the response I receive from the application server which
> always answers with a redirection but omit the version in the response. It
> answers me as following :
> https://ip:port
> /subdirectory/common/loginView.do;jsessionid=C3E6707A5BA4FD393B5E22525F4D764B
> whereas I expect  :
> https://ip:port
> /version/subdirectory/common/loginView.do;jsessionid=C3E6707A5BA4FD393B5E22525F4D764B
>
> Could someone help me with the rewriting of the response from the
> application server, to be able to keep the version inside the url I get as
> answer from the server and which is viewed by the user ?
>
> I hope that I've been clear enough and that this has an easy solution.
> I've read some topic that I think are related to this, but no solution fit
> to my issue.
> Thanks in advance.
> Loic
>