You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by chetan jain <cp...@gmail.com> on 2015/12/18 14:35:11 UTC

[users@httpd] Help with Apache configuration

Hi all,

I have a scenario where i have different instances of the same application
deployed on different boxes and we call those instances as app1, app2.

and the actual URL for both will be like this :

http://host_name1:app1_port>/app/WebObject/app.woa   ....for app1
http://host_name2:app2_port/app/WebObject/app.woa    .... for app2

I have tried the configuration in apache like this :

#For app-1

   RewriteRule ^/app1$ /app1/ [R]
   RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
   ProxyPass /app/WebObjects/app.woa/ http://host_name1:app1_port
/app/WebObjects/app.woa/
   ProxyPassReverse /app/WebObjects/app.woa/   http://host_name1:app1_port
/app/WebObjects/app.woa/

# For app-2

   RewriteRule ^/app2$ /app2/ [R]
   RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
   ProxyPass /app/WebObjects/app.woa/ http://host_name2:app2_port
/app/WebObjects/app.woa/
   ProxyPassReverse /app/WebObjects/app.woa/   http://host_name2:app2_port
/app/WebObjects/app.woa/

and I try to access the page like this :

http://apache_host/app1    and http://apache_host/app2

The first page comes up fine (and actually it is same for both the apps),
However if i click on any other page, it ends up going to app1 only

reason i think is, this part ( /app/WebObjects/app.woa ) of the URL is
common for both and may be webserver gets confused whom to forward the
request.

can someone help to get around this problem?

Regards,
Chetan Jain

[users@httpd] Re: Help with Apache configuration

Posted by chetan jain <cp...@gmail.com>.
Any pointers are highly appreciated.

On Fri, Dec 18, 2015 at 7:05 PM, chetan jain <cp...@gmail.com> wrote:

> Hi all,
>
> I have a scenario where i have different instances of the same application
> deployed on different boxes and we call those instances as app1, app2.
>
> and the actual URL for both will be like this :
>
> http://host_name1:app1_port>/app/WebObject/app.woa   ....for app1
> http://host_name2:app2_port/app/WebObject/app.woa    .... for app2
>
> I have tried the configuration in apache like this :
>
> #For app-1
>
>    RewriteRule ^/app1$ /app1/ [R]
>    RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ http://host_name1:app1_port
> /app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/   http://host_name1:app1_port
> /app/WebObjects/app.woa/
>
> # For app-2
>
>    RewriteRule ^/app2$ /app2/ [R]
>    RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ http://host_name2:app2_port
> /app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/   http://host_name2:app2_port
> /app/WebObjects/app.woa/
>
> and I try to access the page like this :
>
> http://apache_host/app1    and http://apache_host/app2
>
> The first page comes up fine (and actually it is same for both the apps),
> However if i click on any other page, it ends up going to app1 only
>
> reason i think is, this part ( /app/WebObjects/app.woa ) of the URL is
> common for both and may be webserver gets confused whom to forward the
> request.
>
> can someone help to get around this problem?
>
> Regards,
> Chetan Jain
>
>

Re: [users@httpd] Help with Apache configuration

Posted by chetan jain <cp...@gmail.com>.
Thanks Tobias, the second option is not feasible, and this all has to be
part of the same domain.

On Tue, Dec 29, 2015 at 7:24 PM, Tobias Adolph <To...@lrz.de> wrote:

> HI Chetan,
>
> you could place them in different virtual-Host-Container (which means
> different domains) or you could alter the url-part
> (/app/WebObjects/app.woa) to another string (like
> /app/webObjects/app1|2.woa) that is different for each backend.
>
> Regards,
> Tobias
>
>
> Am 29.12.2015 um 14:43 schrieb chetan jain:
>
> Thanks Tobias,
>
> The problem with that would be, I won't be able to ProxyPass with path in
> Location bock.
>
> --Chetan
>
> On Tue, Dec 29, 2015 at 4:03 PM, Tobias Adolph <To...@lrz.de>
> wrote:
>
>> Hi Jain,
>>
>> did you configure those in the same virtualhost-Block?
>>
>> Am 18.12.2015 um 14:35 schrieb chetan jain:
>>
>> #For app-1
>>
>>    RewriteRule ^/app1$ /app1/ [R]
>>    RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
>>    ProxyPass /app/WebObjects/app.woa/ http://host_name1:app1_port
>> /app/WebObjects/app.woa/
>>    ProxyPassReverse /app/WebObjects/app.woa/   http://host_name1:app1_port
>> /app/WebObjects/app.woa/
>>
>> # For app-2
>>
>>    RewriteRule ^/app2$ /app2/ [R]
>>    RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
>>    ProxyPass /app/WebObjects/app.woa/ http://host_name2:app2_port
>> /app/WebObjects/app.woa/
>>    ProxyPassReverse /app/WebObjects/app.woa/   http://host_name2:app2_port
>> /app/WebObjects/app.woa/
>>
>>
>> If this the case try to encapsulate the two blocks in separate
>> Location-Blocks (like <Location /app1/> etc..
>>
>> Kind regards,
>> Tobias Adolph
>>
>> --
>> ###############################
>> # Tobias Adolph               #		
>> # Leibniz-Rechenzentrum       #
>> # Zimmer I.2.019              #
>> # Boltzmannstraße 1           #	
>> # 85748 Garching bei München  #	
>> ###############################
>>
>>
>
> --
> ###############################
> # Tobias Adolph               #		
> # Leibniz-Rechenzentrum       #
> # Zimmer I.2.019              #
> # Boltzmannstraße 1           #	
> # 85748 Garching bei München  #	
> ###############################
>
>

Re: [users@httpd] Help with Apache configuration

Posted by Tobias Adolph <To...@lrz.de>.
HI Chetan,

you could place them in different virtual-Host-Container (which means 
different domains) or you could alter the url-part 
(/app/WebObjects/app.woa) to another string (like 
/app/webObjects/app1|2.woa) that is different for each backend.

Regards,
Tobias

Am 29.12.2015 um 14:43 schrieb chetan jain:
> Thanks Tobias,
>
> The problem with that would be, I won't be able to ProxyPass with path 
> in Location bock.
>
> --Chetan
>
> On Tue, Dec 29, 2015 at 4:03 PM, Tobias Adolph <Tobias.Adolph@lrz.de 
> <ma...@lrz.de>> wrote:
>
>     Hi Jain,
>
>     did you configure those in the same virtualhost-Block?
>
>     Am 18.12.2015 um 14:35 schrieb chetan jain:
>>     #For app-1
>>
>>        RewriteRule ^/app1$ /app1/ [R]
>>        RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
>>        ProxyPass /app/WebObjects/app.woa/
>>     http://host_name1:app1_port/app/WebObjects/app.woa/
>>        ProxyPassReverse /app/WebObjects/app.woa/
>>     http://host_name1:app1_port/app/WebObjects/app.woa/
>>
>>     # For app-2
>>
>>        RewriteRule ^/app2$ /app2/ [R]
>>        RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
>>        ProxyPass /app/WebObjects/app.woa/
>>     http://host_name2:app2_port/app/WebObjects/app.woa/
>>        ProxyPassReverse /app/WebObjects/app.woa/
>>     http://host_name2:app2_port/app/WebObjects/app.woa/
>
>     If this the case try to encapsulate the two blocks in separate
>     Location-Blocks (like <Location /app1/> etc..
>
>     Kind regards,
>     Tobias Adolph
>
>     -- 
>     ###############################
>     # Tobias Adolph               #		
>     # Leibniz-Rechenzentrum       #
>     # Zimmer I.2.019              #
>     # Boltzmannstraße 1           #	
>     # 85748 Garching bei München  #	
>     ###############################
>
>

-- 
###############################
# Tobias Adolph               #		
# Leibniz-Rechenzentrum       #
# Zimmer I.2.019              #
# Boltzmannstraße 1           #	
# 85748 Garching bei München  #	
###############################


Re: [users@httpd] Help with Apache configuration

Posted by chetan jain <cp...@gmail.com>.
Thanks Tobias,

The problem with that would be, I won't be able to ProxyPass with path in
Location bock.

--Chetan

On Tue, Dec 29, 2015 at 4:03 PM, Tobias Adolph <To...@lrz.de> wrote:

> Hi Jain,
>
> did you configure those in the same virtualhost-Block?
>
> Am 18.12.2015 um 14:35 schrieb chetan jain:
>
> #For app-1
>
>    RewriteRule ^/app1$ /app1/ [R]
>    RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ http://host_name1:app1_port
> /app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/   http://host_name1:app1_port
> /app/WebObjects/app.woa/
>
> # For app-2
>
>    RewriteRule ^/app2$ /app2/ [R]
>    RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ http://host_name2:app2_port
> /app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/   http://host_name2:app2_port
> /app/WebObjects/app.woa/
>
>
> If this the case try to encapsulate the two blocks in separate
> Location-Blocks (like <Location /app1/> etc..
>
> Kind regards,
> Tobias Adolph
>
> --
> ###############################
> # Tobias Adolph               #		
> # Leibniz-Rechenzentrum       #
> # Zimmer I.2.019              #
> # Boltzmannstraße 1           #	
> # 85748 Garching bei München  #	
> ###############################
>
>

Re: [users@httpd] Help with Apache configuration

Posted by Tobias Adolph <To...@lrz.de>.
Hi Jain,

did you configure those in the same virtualhost-Block?

Am 18.12.2015 um 14:35 schrieb chetan jain:
> #For app-1
>
>    RewriteRule ^/app1$ /app1/ [R]
>    RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ 
> http://host_name1:app1_port/app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/ 
> http://host_name1:app1_port/app/WebObjects/app.woa/
>
> # For app-2
>
>    RewriteRule ^/app2$ /app2/ [R]
>    RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ 
> http://host_name2:app2_port/app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/ 
> http://host_name2:app2_port/app/WebObjects/app.woa/

If this the case try to encapsulate the two blocks in separate 
Location-Blocks (like <Location /app1/> etc..

Kind regards,
Tobias Adolph

-- 
###############################
# Tobias Adolph               #		
# Leibniz-Rechenzentrum       #
# Zimmer I.2.019              #
# Boltzmannstraße 1           #	
# 85748 Garching bei München  #	
###############################


Re: [users@httpd] Help with Apache configuration

Posted by chetan jain <cp...@gmail.com>.
to elaborate more, the first page comes up fine, and which is exactly same
for app1 and app2 (these are exactly the same apps just separated by
instances to have different configurations in the UI, and assigned for
different groups doing the same functionality), problem comes up when i hit
on any other hyperlink from first page, it always lands up on the app1
(This is with the original configuration i had posted)

On Wed, Dec 30, 2015 at 7:18 PM, chetan jain <cp...@gmail.com> wrote:

> niether of it works, for some unknows reason it tried to look for /app1
> under document root.
>
>
>
> On Tue, Dec 29, 2015 at 7:54 PM, Yann Ylavic <yl...@gmail.com> wrote:
>
>> On Tue, Dec 29, 2015 at 3:16 PM, Yann Ylavic <yl...@gmail.com>
>> wrote:
>> >
>> > You possibly need something like:
>> >
>> >     RewriteRule ^/app1/(.*)
>> > http://host_name1:app1_port/app/WebObjects/app.woa/$1 [P]
>> >     RewriteRule ^/app2/(.*)
>> > http://host_name2:app2_port/app/WebObjects/app.woa/$1 [P]
>> >     <Proxy "http://host_name1:app1_port/app/WebObjects/app.woa/">
>> >     </Proxy>
>> >     <Proxy "http://host_name2:app2_port/app/WebObjects/app.woa/">
>> >     </Proxy>
>>
>> Or maybe even simpler:
>>     ProxyPass /app1/ http://host_name1:app1_port/app/WebObjects/app.woa/
>>     ProxyPass /app2/ http://host_name2:app2_port/app/WebObjects/app.woa/
>>     ProxyPassReverse /app1/ http://host_name1:app1_port
>> /app/WebObjects/app.woa/
>>     ProxyPassReverse /app2/ http://host_name2:app2_port
>> /app/WebObjects/app.woa/
>>
>> Doesn't this work?
>>
>> Regards,
>> Yann.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

Re: [users@httpd] Help with Apache configuration

Posted by chetan jain <cp...@gmail.com>.
niether of it works, for some unknows reason it tried to look for /app1
under document root.



On Tue, Dec 29, 2015 at 7:54 PM, Yann Ylavic <yl...@gmail.com> wrote:

> On Tue, Dec 29, 2015 at 3:16 PM, Yann Ylavic <yl...@gmail.com> wrote:
> >
> > You possibly need something like:
> >
> >     RewriteRule ^/app1/(.*)
> > http://host_name1:app1_port/app/WebObjects/app.woa/$1 [P]
> >     RewriteRule ^/app2/(.*)
> > http://host_name2:app2_port/app/WebObjects/app.woa/$1 [P]
> >     <Proxy "http://host_name1:app1_port/app/WebObjects/app.woa/">
> >     </Proxy>
> >     <Proxy "http://host_name2:app2_port/app/WebObjects/app.woa/">
> >     </Proxy>
>
> Or maybe even simpler:
>     ProxyPass /app1/ http://host_name1:app1_port/app/WebObjects/app.woa/
>     ProxyPass /app2/ http://host_name2:app2_port/app/WebObjects/app.woa/
>     ProxyPassReverse /app1/ http://host_name1:app1_port
> /app/WebObjects/app.woa/
>     ProxyPassReverse /app2/ http://host_name2:app2_port
> /app/WebObjects/app.woa/
>
> Doesn't this work?
>
> Regards,
> Yann.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Help with Apache configuration

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Dec 29, 2015 at 3:16 PM, Yann Ylavic <yl...@gmail.com> wrote:
>
> You possibly need something like:
>
>     RewriteRule ^/app1/(.*)
> http://host_name1:app1_port/app/WebObjects/app.woa/$1 [P]
>     RewriteRule ^/app2/(.*)
> http://host_name2:app2_port/app/WebObjects/app.woa/$1 [P]
>     <Proxy "http://host_name1:app1_port/app/WebObjects/app.woa/">
>     </Proxy>
>     <Proxy "http://host_name2:app2_port/app/WebObjects/app.woa/">
>     </Proxy>

Or maybe even simpler:
    ProxyPass /app1/ http://host_name1:app1_port/app/WebObjects/app.woa/
    ProxyPass /app2/ http://host_name2:app2_port/app/WebObjects/app.woa/
    ProxyPassReverse /app1/ http://host_name1:app1_port/app/WebObjects/app.woa/
    ProxyPassReverse /app2/ http://host_name2:app2_port/app/WebObjects/app.woa/

Doesn't this work?

Regards,
Yann.

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


Re: [users@httpd] Help with Apache configuration

Posted by Yann Ylavic <yl...@gmail.com>.
Hi,

On Fri, Dec 18, 2015 at 2:35 PM, chetan jain <cp...@gmail.com> wrote:
>
> #For app-1
>
>    RewriteRule ^/app1$ /app1/ [R]
>    RewriteRule ^/app1/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ http://host_name1:app1_port/app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/  http://host_name1:app1_port/app/WebObjects/app.woa/
>
> # For app-2
>
>    RewriteRule ^/app2$ /app2/ [R]
>    RewriteRule ^/app2/(.*) /app/WebObjects/app.woa/$1 [P]
>    ProxyPass /app/WebObjects/app.woa/ http://host_name2:app2_port/app/WebObjects/app.woa/
>    ProxyPassReverse /app/WebObjects/app.woa/ http://host_name2:app2_port/app/WebObjects/app.woa/

You possibly need something like:

    RewriteRule ^/app1/(.*)
http://host_name1:app1_port/app/WebObjects/app.woa/$1 [P]
    RewriteRule ^/app2/(.*)
http://host_name2:app2_port/app/WebObjects/app.woa/$1 [P]
    <Proxy "http://host_name1:app1_port/app/WebObjects/app.woa/">
    </Proxy>
    <Proxy "http://host_name2:app2_port/app/WebObjects/app.woa/">
    </Proxy>

The last <Proxy> blocks are not mandatory unless you want to reuse
backend connections for successive requests (like ProxyPass does), you
may even want to ProxySet some parameters in there.

Regards,
Yann.

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