You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nick Ascione <ni...@jhu.edu> on 2006/09/20 18:52:07 UTC

[users@httpd] proxypass ignore case issue

I have a server setup as a reverse proxy for a server called for example 
www.somedomain.com

If a user goes to http://www.somedomain.com/somedir, I want it to goto 
http://appserver.blah.com/somedir

I have the following

<LocationMatch "/somedir">
ProxyPass          http://appserver.blah.com/somedir
ProxyPassReverse   http://appserver.blah.com/somedir
</LocationMatch>

The above works great. The problem is, that is does not match 
http://www.somedomain.com/Somedir or /SoMeDir etc etc...

I want it to ignore case. Is there a way to do this easily with using 
mod_rewrite?

I am running
Server version: Apache/2.0.52
Server built:   Aug  2 2006 05:21:10

with Mod_proxy





---------------------------------------------------------------------
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] proxypass ignore case issue

Posted by Joshua Slive <jo...@slive.ca>.
On 9/21/06, Nick Ascione <ni...@jhu.edu> wrote:
> Thanks Rainer.
>
> The mod_speling works great. However I have a new interesting problem
>
> In my vhost I have
>
> proxypass /somedir  /http://www.somedomain.com/somedir
> proxypassreverse /somedir  /http://www.somedomain.com/somedir
>
> The above works fine and mod_speling catches any weird way that somedir
> can be written.
>
> But...
> Since I need this server to also proxy requests to / for
> www.somedomain.com when I put in
>
> proxypass /  http://www.somedomain.com
> proxypassreverse /  /http://www.somedomain.com/somedir
>
> the mod_speling no longer works. It seems to only process only if none
> of the proxypass rules match
> and since the rule for / matches http://www.somedomain.com/SoMeDir
> mod_speling does not kick in.
>
> Do you know of a way around this?

This is complex enough that it is best dealt with in mod_rewrite:

RewriteEngine On
RewriteRule /somedir(.*) http://www.somedomain.com/somedir$1 [P,L]
RewriteRule /somedir(.*) http://%{SERVER_NAME}/somedir$1 [NC,R,L]
RewriteRule (.*) http://www.somedomain.com$1 [P,L]
ProxyPassReverse ...

Joshua.

---------------------------------------------------------------------
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] proxypass ignore case issue

Posted by Nick Ascione <ni...@jhu.edu>.
In my case the backend host is a IIS server. Any ideas?


Rainer Perske wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
>
> Nick Ascione schrieb am 2006-09-21:
>
>   
>> Thanks Rainer.
>>     
>
>   
>> The mod_speling works great.
>>     
>
> fine :-)
>
>   
>> However I have a new interesting problem
>>     
>
>   
>> In my vhost I have
>>     
>
>   
>> proxypass /somedir  /http://www.somedomain.com/somedir
>> proxypassreverse /somedir  /http://www.somedomain.com/somedir
>>     
>
>   
>> The above works fine and mod_speling catches any weird way that
>> somedir can be written.
>>     
>
>   
>> But... Since I need this server to also proxy requests to / for
>> www.somedomain.com when I put in
>>     
>
>   
>> proxypass /  http://www.somedomain.com
>> proxypassreverse / /http://www.somedomain.com/somedir
>>     
>
> that's out of sync, try
>
> proxypass / http://www.somedomain.com
> proxypassreverse / http://www.somedomain.com
>
> (both lines after all other proxypass/proxypassreverse lines)
>
>   
>> the mod_speling no longer works. It seems to only process only if
>> none of the proxypass rules match and since the rule for / matches
>> http://www.somedomain.com/SoMeDir mod_speling does not kick in.
>>     
>
>   
>> Do you know of a way around this?
>>     
>
> Simply activate mod_speling on the backend host, too. The redirect
> coming from the backend host gets rewritten by the proxy host exactly
> as needed due to the proxypassreverse directive, thus it is important
> that the parameters of proxypass and proxypassreverse are identical.
>
> HTH
>
> cu
> - -- 
> Rainer Perske, Zentrum für Informationsverarbeitung, Universität Münster
> Lesetipp: <http://www.textkritik.de/schriftundcharakter/sundc008tofu.htm>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (AIX)
>
> iQDVAwUBRRKjl89UbnbjB8C5AQGElAYAkYosxiUdO40su4ChcNO340+zrMNwQ9eO
> rkXausFjs4H+EVfPoUAi/gh7kl/IgxbYRQ83pl4Gt1/m9dpZOMO/ZG4DEJMyGMRn
> gfIGssFi7WWKesDAjKT19cGNEAOVvhLTdIwvvJUzi79mpDTEEQprJ+1qzXOqDdtD
> jDuSloZiKUD4/aZGL6vZtv2OPO1gc4T5gGJ0L2gQwZkFFBEFh2POak8Wur3mE2D+
> GbAWCIe3Yw8k0cU9nwL2yJzRqPwEgHvU
> =j2A8
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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] proxypass ignore case issue

Posted by Rainer Perske <ra...@uni-muenster.de>.
-----BEGIN PGP SIGNED MESSAGE-----

Nick Ascione schrieb am 2006-09-21:

> Thanks Rainer.

> The mod_speling works great.

fine :-)

> However I have a new interesting problem

> In my vhost I have

> proxypass /somedir  /http://www.somedomain.com/somedir
> proxypassreverse /somedir  /http://www.somedomain.com/somedir

> The above works fine and mod_speling catches any weird way that
> somedir can be written.

> But... Since I need this server to also proxy requests to / for
> www.somedomain.com when I put in

> proxypass /  http://www.somedomain.com
> proxypassreverse / /http://www.somedomain.com/somedir

that's out of sync, try

proxypass / http://www.somedomain.com
proxypassreverse / http://www.somedomain.com

(both lines after all other proxypass/proxypassreverse lines)

> the mod_speling no longer works. It seems to only process only if
> none of the proxypass rules match and since the rule for / matches
> http://www.somedomain.com/SoMeDir mod_speling does not kick in.

> Do you know of a way around this?

Simply activate mod_speling on the backend host, too. The redirect
coming from the backend host gets rewritten by the proxy host exactly
as needed due to the proxypassreverse directive, thus it is important
that the parameters of proxypass and proxypassreverse are identical.

HTH

cu
- -- 
Rainer Perske, Zentrum für Informationsverarbeitung, Universität Münster
Lesetipp: <http://www.textkritik.de/schriftundcharakter/sundc008tofu.htm>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (AIX)

iQDVAwUBRRKjl89UbnbjB8C5AQGElAYAkYosxiUdO40su4ChcNO340+zrMNwQ9eO
rkXausFjs4H+EVfPoUAi/gh7kl/IgxbYRQ83pl4Gt1/m9dpZOMO/ZG4DEJMyGMRn
gfIGssFi7WWKesDAjKT19cGNEAOVvhLTdIwvvJUzi79mpDTEEQprJ+1qzXOqDdtD
jDuSloZiKUD4/aZGL6vZtv2OPO1gc4T5gGJ0L2gQwZkFFBEFh2POak8Wur3mE2D+
GbAWCIe3Yw8k0cU9nwL2yJzRqPwEgHvU
=j2A8
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] proxypass ignore case issue

Posted by Nick Ascione <ni...@jhu.edu>.
Thanks Rainer.

The mod_speling works great. However I have a new interesting problem

In my vhost I have

proxypass /somedir  /http://www.somedomain.com/somedir
proxypassreverse /somedir  /http://www.somedomain.com/somedir

The above works fine and mod_speling catches any weird way that somedir 
can be written.

But...
Since I need this server to also proxy requests to / for 
www.somedomain.com when I put in

proxypass /  http://www.somedomain.com
proxypassreverse /  /http://www.somedomain.com/somedir

the mod_speling no longer works. It seems to only process only if none 
of the proxypass rules match
and since the rule for / matches http://www.somedomain.com/SoMeDir 
mod_speling does not kick in.

Do you know of a way around this?

Thanks,
Nick









Rainer Perske wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
>
> Nick Ascione schrieb am 2006-09-20:
>
>   
>> [reverse proxy for <http://www.somedomain.com/somedir> is configured]
>> [creating a local directory .../htdocs/somedir triggers mod_speling]
>> [so that that .../SoMeDir gets redirected to .../somedir]
>>     
>
>   
>> With mod_speling, that only appears to work if the directory is on
>> the local machine?
>>     
>
> correct.
>
>   
>> What about in the case of a reverse proxy?
>>     
>
> When a user goes to <http://www.somedomain.com/SoMeDir> there is no
> need for a reverse proxy. mod_speling returns a Redirect because it
> finds the local dummy directory "somedir" in the local "htdocs"
> directory.
>
> When the browser follows the redirect, i.e. when it sends a new request
> to <http://www.somedomain.com/somedir>, your existent reverse proxy
> configuration entry is regarded, thus the server does not even look
> at/into the dummy directory now.
>
> I.e. the server will never serve any contents of the dummy directory.
>
> (It does not even matter whether "somedir" is a directory or a file or
> a symlink or something else: only the pure entry of the name in the
> htdocs directory is regarded by mod_speling. I myself use "ln -sf
> Redirect .../htdocs/somedir" to create a dangling symbolic link for
> this purpose.)
>
> HTH
> - -- 
> Rainer Perske, Zentrum für Informationsverarbeitung, Universität Münster
> Lesetipp: <http://www.textkritik.de/schriftundcharakter/sundc008tofu.htm>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (AIX)
>
> iQDVAwUBRRJTtM9UbnbjB8C5AQFAgwYAomuPF75depgG9rBGnFEIX2WQ7x7qX6rd
> JtrifizG+mwHXH4oo8TQ2mawB6qh3F5CMRKMb0p7RHMuCuOwSS696lS1I1qVm5Br
> igyCE1t1saRlMnQdn8A5wHiQ0Qa1J56WtokrbI75uYPQ/0VxQQ1+P+LlasSiy/kE
> 24GAmI4tvglLFcGIwJDk6ZGnqjeu+OAb94Mqvyo9Wzr5yFljpDKHyMaRcca48sS/
> o2CjbA620huyjO+ePUM1biX/jWQp1l7+
> =YUZ2
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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] proxypass ignore case issue

Posted by Rainer Perske <ra...@uni-muenster.de>.
-----BEGIN PGP SIGNED MESSAGE-----

Nick Ascione schrieb am 2006-09-20:

> [reverse proxy for <http://www.somedomain.com/somedir> is configured]
> [creating a local directory .../htdocs/somedir triggers mod_speling]
> [so that that .../SoMeDir gets redirected to .../somedir]

> With mod_speling, that only appears to work if the directory is on
> the local machine?

correct.

> What about in the case of a reverse proxy?

When a user goes to <http://www.somedomain.com/SoMeDir> there is no
need for a reverse proxy. mod_speling returns a Redirect because it
finds the local dummy directory "somedir" in the local "htdocs"
directory.

When the browser follows the redirect, i.e. when it sends a new request
to <http://www.somedomain.com/somedir>, your existent reverse proxy
configuration entry is regarded, thus the server does not even look
at/into the dummy directory now.

I.e. the server will never serve any contents of the dummy directory.

(It does not even matter whether "somedir" is a directory or a file or
a symlink or something else: only the pure entry of the name in the
htdocs directory is regarded by mod_speling. I myself use "ln -sf
Redirect .../htdocs/somedir" to create a dangling symbolic link for
this purpose.)

HTH
- -- 
Rainer Perske, Zentrum für Informationsverarbeitung, Universität Münster
Lesetipp: <http://www.textkritik.de/schriftundcharakter/sundc008tofu.htm>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (AIX)

iQDVAwUBRRJTtM9UbnbjB8C5AQFAgwYAomuPF75depgG9rBGnFEIX2WQ7x7qX6rd
JtrifizG+mwHXH4oo8TQ2mawB6qh3F5CMRKMb0p7RHMuCuOwSS696lS1I1qVm5Br
igyCE1t1saRlMnQdn8A5wHiQ0Qa1J56WtokrbI75uYPQ/0VxQQ1+P+LlasSiy/kE
24GAmI4tvglLFcGIwJDk6ZGnqjeu+OAb94Mqvyo9Wzr5yFljpDKHyMaRcca48sS/
o2CjbA620huyjO+ePUM1biX/jWQp1l7+
=YUZ2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] proxypass ignore case issue

Posted by Nick Ascione <ni...@jhu.edu>.
With mod_speling, that only appears to work if the directory is on the 
local machine? What about in the case of a reverse proxy?

Rainer Perske wrote:
> Hi
>
> Nick Ascione schrieb am 2006-09-20:
>   
>> I have a server setup as a reverse proxy for a server called for
>> example www.somedomain.com
>>     
>
>   
>> If a user goes to http://www.somedomain.com/somedir, I want it to
>> goto http://appserver.blah.com/somedir
>>     
>
>   
>> I have the following
>>     
>
>   
>> <LocationMatch "/somedir">
>> ProxyPass          http://appserver.blah.com/somedir
>> ProxyPassReverse   http://appserver.blah.com/somedir
>> </LocationMatch>
>>     
>
>   
>> The above works great. The problem is, that is does not match
>> http://www.somedomain.com/Somedir or /SoMeDir etc etc...
>>     
>
>   
>> I want it to ignore case. Is there a way to do this easily with
>> using mod_rewrite?
>>     
>
> I prefer mod_speling using a dummy directory:
>
>    mkdir /path/to/htdocs/somedir
>
> When the browser requests <http://www.somedomain.com/SoMeDir>, mod_speling
> returns a redirect to <http://www.somedomain.com/somedir>. Voilà!
>
> HTH
>   

---------------------------------------------------------------------
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] proxypass ignore case issue

Posted by Rainer Perske <ra...@uni-muenster.de>.
Hi

Nick Ascione schrieb am 2006-09-20:
> I have a server setup as a reverse proxy for a server called for
> example www.somedomain.com

> If a user goes to http://www.somedomain.com/somedir, I want it to
> goto http://appserver.blah.com/somedir

> I have the following

> <LocationMatch "/somedir">
> ProxyPass          http://appserver.blah.com/somedir
> ProxyPassReverse   http://appserver.blah.com/somedir
> </LocationMatch>

> The above works great. The problem is, that is does not match
> http://www.somedomain.com/Somedir or /SoMeDir etc etc...

> I want it to ignore case. Is there a way to do this easily with
> using mod_rewrite?

I prefer mod_speling using a dummy directory:

   mkdir /path/to/htdocs/somedir

When the browser requests <http://www.somedomain.com/SoMeDir>, mod_speling
returns a redirect to <http://www.somedomain.com/somedir>. Voilà!

HTH
-- 
Rainer Perske, Zentrum für Informationsverarbeitung, Universität Münster
Lesetipp: <http://www.textkritik.de/schriftundcharakter/sundc008tofu.htm>

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