RewriteRule being ignored

RewriteRule being ignored

am 21.02.2006 07:01:45 von David Hull

------=_NextPart_000_0040_01C63671.9ED102A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am running apache 2.0.50 on SuSE 9.2. I also run Tomcat 5.0.28 and =
pass connections to it from Apache. I installed Apache from the SuSE =
package.

My RewriteRule is not working. It appears to be completely ignored. =
Connections get passed to Tomcat via the Proxy pass w/o being rewritten. =

I have enabled the RewriteRuleLog and set the log level to 9. The log =
file is created but is not written to. I am missing something obvious I =
am sure but am too much of a newbie still to be sure just what.=20

Any suggestions are appreciated.

My settings:


ServerName www.myserver.com
RewriteEngine On

RewriteRule ^/gift/(.*)$ http://www.myserver.com/buy.jsp?gift=3D$1
RewriteRule ^/refer/(.*)$ http://www.myserver.com/buy.jsp?refer=3D$1

ProxyPass /download/ http://www.myserver.com/download/
ProxyPassReverse /download/ http://www.myserver.com/download/
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/


Thanks,

David
------=_NextPart_000_0040_01C63671.9ED102A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">




I am running apache 2.0.50 on SuSE 9.2. =
I also run=20
Tomcat 5.0.28 and pass connections to it from Apache. I installed Apache =
from=20
the SuSE package.

My RewriteRule is not working. It =
appears to be=20
completely ignored. Connections get passed to Tomcat via the Proxy pass =
w/o=20
being rewritten.
I have enabled the RewriteRuleLog and set the log =
level to=20
9. The log file is created but is not written to. I am missing something =
obvious=20
I am sure but am too much of a newbie still to be sure just what. =

 

Any suggestions are =
appreciated.

 

My settings:


<VirtualHost *:80>
  =
ServerName=20

  =
RewriteEngine=20
On


  RewriteRule ^/gift/(.*)$ href=3D"http://www.myserver.com/buy.jsp?gift=3D$1">http://ww w.myserver.co=
m/buy.jsp?gift=3D$1
 =20
RewriteRule ^/refer/(.*)$ href=3D"http://www.myserver.com/buy.jsp?refer=3D$1">http://w ww.myserver.c=
om/buy.jsp?refer=3D$1


  ProxyPass /download/ href=3D"http://www.myserver.com/download/">http://www.myserv er.com/downlo=
ad/
 =20
ProxyPassReverse /download/ href=3D"http://www.myserver.com/download/">http://www.myserv er.com/downlo=
ad/
 =20
ProxyPass / href=3D"http://127.0.0.1:8080/">http://127.0.0.1:8080/
 =20
ProxyPassReverse / href=3D"http://127.0.0.1:8080/">http://127.0.0.1:8080/
</Virtua=
lHost>

Thanks,

 

David


------=_NextPart_000_0040_01C63671.9ED102A0--

Re: RewriteRule being ignored

am 21.02.2006 10:22:35 von Joost de Heer

David Hull wrote:
> I am running apache 2.0.50 on SuSE 9.2. I also run Tomcat 5.0.28 and pass
> connections to it from Apache. I installed Apache from the SuSE package.
>
> My RewriteRule is not working. It appears to be completely ignored.
> Connections get passed to Tomcat via the Proxy pass w/o being rewritten.
> I have enabled the RewriteRuleLog and set the log level to 9. The log file
> is created but is not written to. I am missing something obvious I am sure
> but am too much of a newbie still to be sure just what.
>
> Any suggestions are appreciated.


In what order are mod_proxy and mod_rewrite loaded? A gross
simplification, but in general, the last loaded module gets called first.

Joost


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: RewriteRule being ignored

am 21.02.2006 13:23:32 von Nick Kew

On Tuesday 21 February 2006 09:22, Joost de Heer wrote:

> In what order are mod_proxy and mod_rewrite loaded? A gross
> simplification, but in general, the last loaded module gets called first.

Only in old (four-years-obsolete) versions of apache.

--
Nick Kew

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: RewriteRule being ignored

am 21.02.2006 15:25:04 von Axel-Stephane.SMORGRAV

If memory serve me right, all mod_proxy hooks execute before mod_rewrite =
in Apache 2.0. Module ordering is irrelevant.

-ascs=20

-----Original Message-----
From: Joost de Heer [mailto:sanguis@xs4all.nl]=20
Sent: Tuesday, February 21, 2006 10:23 AM
To: David Hull
Cc: users@httpd.apache.org
Subject: [users@httpd] Re: RewriteRule being ignored

David Hull wrote:
> I am running apache 2.0.50 on SuSE 9.2. I also run Tomcat 5.0.28 and=20
> pass connections to it from Apache. I installed Apache from the SuSE =
package.
>
> My RewriteRule is not working. It appears to be completely ignored.
> Connections get passed to Tomcat via the Proxy pass w/o being =
rewritten.
> I have enabled the RewriteRuleLog and set the log level to 9. The log=20
> file is created but is not written to. I am missing something obvious=20
> I am sure but am too much of a newbie still to be sure just what.
>
> Any suggestions are appreciated.


In what order are mod_proxy and mod_rewrite loaded? A gross =
simplification, but in general, the last loaded module gets called =
first.

Joost


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server =
Project.
See 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 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: RewriteRule being ignored

am 21.02.2006 16:46:45 von Robert Ionescu

David Hull wrote:
>
> ServerName www.myserver.com
> RewriteEngine On
>
> RewriteRule ^/gift/(.*)$ http://www.myserver.com/buy.jsp?gift=$1
> RewriteRule ^/refer/(.*)$ http://www.myserver.com/buy.jsp?refer=$1
>
> ProxyPass /download/ http://www.myserver.com/download/
> ProxyPassReverse /download/ http://www.myserver.com/download/

You're proxying to your same domain? ServerName was set to
www.myserver.com and the proxying goes to www.myserver.com on port 80.

May be you're trying to exclude /download/ from being proxied to :8080?
If yes, I'd use

ProxyPass /download !
ProxyPass / http://127.0.0.1:8080/

in order to exclude the /download path.

But in this case I'd use only mod_rewrite like


ServerName www.myserver.com
RewriteEngine On
RewriteRule ^/(gift|refer)/(.*)$ http://127.0.0.1:8080/buy.jsp?$1=$2 [P]
RewriteCond $1 !^download
RewriteRule ^/(.*) http://127.0.0.1:8080/$1 [P]

ProxyPassReverse / http://127.0.0.1:8080/


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: RewriteRule being ignored

am 21.02.2006 16:52:44 von Joost de Heer

Axel-Stéphane SMORGRAV wrote:
> If memory serve me right, all mod_proxy hooks execute before mod_rewrite
> in Apache 2.0. Module ordering is irrelevant.

In that case, reverse proxying must be done with mod_rewrite, something
like (untested!):


ServerName www.myserver.com
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/gift/.*
RewriteRule ^/gift/(.*)$ http://www.myserver.com/buy.jsp?gift=$1
RewriteCond %{REQUEST_URI} ^/gift/.*
RewriteRule ^/refer/(.*)$ http://www.myserver.com/buy.jsp?refer=$1
RewriteCond %{REQUEST_URI} ^/download/.*
RewriteRule /(.*) http://www.myserver.com/$1 [P,L]
RewriteRule /(.*) http://127.0.0.1:8080/$1 [P]

ProxyPassReverse /download/ http://www.myserver.com/download/
ProxyPassReverse / http://127.0.0.1:8080/


Possibly with a few extra RewriteCond's to avoid looping.

Joost


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: RewriteRule being ignored

am 21.02.2006 18:28:35 von Axel-Stephane.SMORGRAV

Has the following been suggested yet ??

VirtualHost *:80>
ServerName www.myserver.com
RewriteEngine On

RewriteRule ^/gift/(.*)$ http://www.myserver.com/buy.jsp?gift=3D$1
RewriteRule ^/refer/(.*)$ http://www.myserver.com/buy.jsp?refer=3D$1

ProxyPass /gift !
ProxyPass /refer !
ProxyPass /download/ http://www.myserver.com/download/
ProxyPassReverse /download/ http://www.myserver.com/download/
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/



-ascs=20

-----Original Message-----
From: Joost de Heer [mailto:sanguis@xs4all.nl]=20
Sent: Tuesday, February 21, 2006 4:53 PM
To: Axel-St=E9phane SMORGRAV; dbhull1@hotmail.com
Cc: users@httpd.apache.org
Subject: RE: [users@httpd] Re: RewriteRule being ignored

Axel-St=E9phane SMORGRAV wrote:
> If memory serve me right, all mod_proxy hooks execute before=20
> mod_rewrite in Apache 2.0. Module ordering is irrelevant.

In that case, reverse proxying must be done with mod_rewrite, something =
like (untested!):


ServerName www.myserver.com
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/gift/.*
RewriteRule ^/gift/(.*)$ http://www.myserver.com/buy.jsp?gift=3D$1
RewriteCond %{REQUEST_URI} ^/gift/.*
RewriteRule ^/refer/(.*)$ http://www.myserver.com/buy.jsp?refer=3D$1
RewriteCond %{REQUEST_URI} ^/download/.*
RewriteRule /(.*) http://www.myserver.com/$1 [P,L]
RewriteRule /(.*) http://127.0.0.1:8080/$1 [P]

ProxyPassReverse /download/ http://www.myserver.com/download/
ProxyPassReverse / http://127.0.0.1:8080/


Possibly with a few extra RewriteCond's to avoid looping.

Joost



------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: RewriteRule being ignored

am 21.02.2006 19:03:28 von David Hull

Thanks to all who responded.

Joost had it right. I changed the order of the modules that load, moving the
2 proxy modules to the end of the list as shown below.

LoadModule rewrite_module /usr/lib64/apache2-prefork/mod_rewrite.so
LoadModule proxy_module /usr/lib64/apache2-prefork/mod_proxy.so
LoadModule proxy_http_module /usr/lib64/apache2-prefork/mod_proxy_http.so

My rewrite rules are working now along with the ProxyPass statements.

Thank you very much!

David


-----Original Message-----
From: Joost de Heer [mailto:sanguis@xs4all.nl]
Sent: Tuesday, February 21, 2006 2:23 AM
To: David Hull
Cc: users@httpd.apache.org
Subject: [users@httpd] Re: RewriteRule being ignored

David Hull wrote:
> I am running apache 2.0.50 on SuSE 9.2. I also run Tomcat 5.0.28 and
> pass connections to it from Apache. I installed Apache from the SuSE
package.
>
> My RewriteRule is not working. It appears to be completely ignored.
> Connections get passed to Tomcat via the Proxy pass w/o being rewritten.
> I have enabled the RewriteRuleLog and set the log level to 9. The log
> file is created but is not written to. I am missing something obvious
> I am sure but am too much of a newbie still to be sure just what.
>
> Any suggestions are appreciated.


In what order are mod_proxy and mod_rewrite loaded? A gross simplification,
but in general, the last loaded module gets called first.

Joost


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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 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