You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Eric Bowman <eb...@boboco.ie> on 2008/09/12 16:06:32 UTC
[users@httpd] redirects conundrum
Hi,
I'm struggling a bit with mod_alias, wondering if someone can help.
I have the following configuration, running against httpd 2.2.6
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from all
</Location>
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
DocumentRoot "/var/www/htdocs"
<Directory "/var/www/htdocs">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Redirect permanent /a http://example.com/a/
Redirect permanent /foo http://example.com/a
Redirect permanent /login http://example.com/a/login
Redirect permanent / http://example.com/a/
ProxyPass /bar balancer://barcluster stickysession=BARID
ProxyPassReverse /bar http://192.168.123.210:35600/bar
ProxyPassReverse /bar http://192.168.123.226:35600/bar
ProxyPassReverse /bar http://192.168.123.227:35600/bar
<proxy balancer://barcluster>
BalancerMember http://192.168.123.210:35600/bar loadfactor=1
route=210
BalancerMember http://192.168.123.226:35600/bar loadfactor=1
route=226
BalancerMember http://192.168.123.227:35600/bar loadfactor=1
route=227
</proxy>
ProxyPass /bar !
ProxyPass /a/ balancer://foocluster/
ProxyPassReverse /a http://192.168.123.226:35640/foo/
<proxy balancer://foocluster>
BalancerMember http://192.168.123.226:35640/foo/ loadfactor=1
</proxy>
</VirtualHost>
In a nutshell, requests to /bar go to to one cluster, and basically
"/everything%20else" gets redirected to "/a/everything%20else", and sent
to a separate cluster. We need this behaviour.
What I'm wondering is, how can I prevent /balancer-manager from
redirecting to /a/balancer-manager? I've tried everything obvious, and
the only way I can make it work is to remove the line "Redirect
permanent / http://example.com/a/" which breaks everything else.
Is there a way to prevent /balancer-manager from redirecting similar to
how /bar doesn't redirect, but without proxying?
Thanks in advance,
Eric
--
Eric Bowman
Boboco Ltd
ebowman@boboco.ie
http://www.boboco.ie/ebowman/pubkey.pgp
+35318394189/+353872801532
---------------------------------------------------------------------
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] redirects conundrum
Posted by Eric Bowman <eb...@boboco.ie>.
Ben Spencer wrote:
> You might want to look at
>
> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
>
> the "'redirect|R [=code]' (force redirect)" section?
>
>
That's the ticket -- thanks!
--
Eric Bowman
Boboco Ltd
ebowman@boboco.ie
http://www.boboco.ie/ebowman/pubkey.pgp
+35318394189/+353872801532
---------------------------------------------------------------------
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] redirects conundrum
Posted by Ben Spencer <be...@moody.edu>.
You might want to look at
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
the "'redirect|R [=code]' (force redirect)" section?
benji
Benji Spencer
System Administrator
Moody Bible Institute
Phone: 312-329-2288
Fax: 312-329-8961
> -----Original Message-----
> From: Eric Bowman [mailto:ebowman@boboco.ie]
> Sent: Friday, September 12, 2008 10:29 AM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] redirects conundrum
>
> Ben Spencer wrote:
> > The issue is that you are redirecting / to /a/
> >
> > You can accomplish what you need with mod_rewrite, though I am not
> sure the
> > processing order for redirects done with Redirect and those done with
> > mod_rewrite so this might involve changing the Redirect permanent
> directives
> > to mod_rewrite redirect directives.
> >
>
> I don't think we can accomplish what we need with mod_rewrite. We need
> /a/ in the address bar to manage cookie domains correctly. We are
> redirecting instead of rewriting for client-side reasons.
>
> If we rewrite instead of redirecting, we end up with big cookies that
> get sent with every request to the server. By redirecting to /a/, our
> cookies end up with the /a/ path and hence don't get sent with all the
> requests to /bar.
>
> Thanks,
> Eric
>
> --
> Eric Bowman
> Boboco Ltd
> ebowman@boboco.ie
> http://www.boboco.ie/ebowman/pubkey.pgp
> +35318394189/+353872801532
>
>
> ---------------------------------------------------------------------
> 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] redirects conundrum
Posted by Eric Bowman <eb...@boboco.ie>.
Ben Spencer wrote:
> The issue is that you are redirecting / to /a/
>
> You can accomplish what you need with mod_rewrite, though I am not sure the
> processing order for redirects done with Redirect and those done with
> mod_rewrite so this might involve changing the Redirect permanent directives
> to mod_rewrite redirect directives.
>
I don't think we can accomplish what we need with mod_rewrite. We need
/a/ in the address bar to manage cookie domains correctly. We are
redirecting instead of rewriting for client-side reasons.
If we rewrite instead of redirecting, we end up with big cookies that
get sent with every request to the server. By redirecting to /a/, our
cookies end up with the /a/ path and hence don't get sent with all the
requests to /bar.
Thanks,
Eric
--
Eric Bowman
Boboco Ltd
ebowman@boboco.ie
http://www.boboco.ie/ebowman/pubkey.pgp
+35318394189/+353872801532
---------------------------------------------------------------------
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] redirects conundrum
Posted by Ben Spencer <be...@moody.edu>.
The issue is that you are redirecting / to /a/
You can accomplish what you need with mod_rewrite, though I am not sure the
processing order for redirects done with Redirect and those done with
mod_rewrite so this might involve changing the Redirect permanent directives
to mod_rewrite redirect directives.
benji
Benji Spencer
System Administrator
Moody Bible Institute
Phone: 312-329-2288
Fax: 312-329-8961
> -----Original Message-----
> From: Eric Bowman [mailto:ebowman@boboco.ie]
> Sent: Friday, September 12, 2008 9:07 AM
> To: users@httpd.apache.org
> Subject: [users@httpd] redirects conundrum
>
> Hi,
>
> I'm struggling a bit with mod_alias, wondering if someone can help.
>
> I have the following configuration, running against httpd 2.2.6
>
> <Location /balancer-manager>
> SetHandler balancer-manager
> Order Deny,Allow
> Deny from all
> Allow from all
> </Location>
>
> <VirtualHost *:80>
> ServerName example.com
> ServerAlias *.example.com
>
> DocumentRoot "/var/www/htdocs"
> <Directory "/var/www/htdocs">
> Options FollowSymLinks
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
>
> Redirect permanent /a http://example.com/a/
> Redirect permanent /foo http://example.com/a
> Redirect permanent /login http://example.com/a/login
> Redirect permanent / http://example.com/a/
>
> ProxyPass /bar balancer://barcluster stickysession=BARID
> ProxyPassReverse /bar http://192.168.123.210:35600/bar
> ProxyPassReverse /bar http://192.168.123.226:35600/bar
> ProxyPassReverse /bar http://192.168.123.227:35600/bar
> <proxy balancer://barcluster>
> BalancerMember http://192.168.123.210:35600/bar loadfactor=1
> route=210
> BalancerMember http://192.168.123.226:35600/bar loadfactor=1
> route=226
> BalancerMember http://192.168.123.227:35600/bar loadfactor=1
> route=227
> </proxy>
>
> ProxyPass /bar !
> ProxyPass /a/ balancer://foocluster/
> ProxyPassReverse /a http://192.168.123.226:35640/foo/
> <proxy balancer://foocluster>
> BalancerMember http://192.168.123.226:35640/foo/ loadfactor=1
> </proxy>
> </VirtualHost>
>
>
> In a nutshell, requests to /bar go to to one cluster, and basically
> "/everything%20else" gets redirected to "/a/everything%20else", and
> sent
> to a separate cluster. We need this behaviour.
>
> What I'm wondering is, how can I prevent /balancer-manager from
> redirecting to /a/balancer-manager? I've tried everything obvious, and
> the only way I can make it work is to remove the line "Redirect
> permanent / http://example.com/a/" which breaks everything else.
>
> Is there a way to prevent /balancer-manager from redirecting similar to
> how /bar doesn't redirect, but without proxying?
>
> Thanks in advance,
> Eric
>
> --
> Eric Bowman
> Boboco Ltd
> ebowman@boboco.ie
> http://www.boboco.ie/ebowman/pubkey.pgp
> +35318394189/+353872801532
>
>
> ---------------------------------------------------------------------
> 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