You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Hull <db...@hotmail.com> on 2006/02/21 07:01:45 UTC

[users@httpd] RewriteRule being ignored

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.

My settings:

<VirtualHost *:80>
  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/
  ProxyPass / http://127.0.0.1:8080/
  ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

Thanks,

David

Re: [users@httpd] Re: RewriteRule being ignored

Posted by Nick Kew <ni...@webthing.com>.
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 <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] Re: RewriteRule being ignored

Posted by David Hull <db...@hotmail.com>.
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 <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


[users@httpd] Re: RewriteRule being ignored

Posted by Joost de Heer <sa...@xs4all.nl>.
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 <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] RewriteRule being ignored

Posted by Robert Ionescu <ro...@googlemail.com>.
David Hull wrote:
> <VirtualHost *:80>
>   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

<VirtualHost *:80>
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/
</VirtualHost>

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