You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Arifolth <ar...@mail.ru> on 2007/11/13 15:37:17 UTC

[users@httpd] apache2 mod_rewrite + mod_proxy internal proxying problem

Hi All!

I need to substitute requested page with aniother, i. e. if client has reqested page http://arifolth/meat[anything].html 
he should get http://arifolth/handbook.html
as far as I understand reverse proxyfying is the only right way to do it
mod rewrite alone works fine, it gave error 302 to the client  - the document has moved ...
but I need to get not a redirection reply but the substituted page itself. when I`m trying to use mod_proxy things are gone bad: server`s answer is always 403 - Access forbidden!
(there are no problems with this page/file acl)
and mod_rewrite log looks like this:
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a80798/initial] (2) init rewrite engine with requested uri /meatbug.htm
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a80798/initial] (3) applying pattern '^/meat(.*)' to uri '/meatbug.htm'
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a80798/initial] (2) rewrite '/meatbug.htm' -> '/handbook.html'
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a80798/initial] (2) forcing proxy-throughput with http://localhost/handbook.html
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a80798/initial] (1) go-ahead with proxy request proxy:http://localhost/handbook.html [OK]
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a849a0/initial/redir#1] (2) init rewrite engine with requested uri /error/HTTP_FORBIDDEN.html.var
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a849a0/initial/redir#1] (3) applying pattern '^/meat(.*)' to uri '/error/HTTP_FORBIDDEN.html.var'
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a849a0/initial/redir#1] (1) pass through /error/HTTP_FORBIDDEN.html.var
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a96848/subreq] (2) init rewrite engine with requested uri /error/include/top.html
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a96848/subreq] (3) applying pattern '^/meat(.*)' to uri '/error/include/top.html'
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a96848/subreq] (1) pass through /error/include/top.html
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a9e888/subreq] (2) init rewrite engine with requested uri /error/include/bottom.html
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a9e888/subreq] (3) applying pattern '^/meat(.*)' to uri '/error/include/bottom.html'
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555a9e888/subreq] (1) pass through /error/include/bottom.html
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555aa28a8/subreq] (2) init rewrite engine with requested uri /error/contact.html.var
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555aa28a8/subreq] (3) applying pattern '^/meat(.*)' to uri '/error/contact.html.var'
127.0.0.1 - - [13/Nov/2007:16:59:21 +0300] [localhost/sid#5555557c37a0][rid#555555aa28a8/subreq] (1) pass through /error/contact.html.var


Any help would be appreciated!

parts of httpd.conf:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog rewrite.log
RewriteLogLevel 9
RewriteRule ^/meat(.*) /handbook.html [P,L]
</IfModule>

<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /handbook.html http://arifolth
ProxyPassReverse /handbook.html http://arifolth
</IfModule>

/usr/sbin/httpd2 -V
Server version: Apache/2.2.3
Server built:   Nov 25 2006 19:58:33
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)

on OpenSuse 10.2 x64

thanx in advance
--
WBR,
Alexander Nilov
mailto:arifolth@mail.ru

---------------------------------------------------------------------
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] apache2 mod_rewrite + mod_proxy internal proxying problem

Posted by Christian Folini <ch...@post.ch>.
hi there,

Have you tried

RewriteRule /meat(.*).html /handbook.html [last]

without any proxying and stuff?

302 is not an error btw. It's a standard http status code.

regs,

Christian



On Tue, Nov 13, 2007 at 05:37:17PM +0300, Arifolth wrote:
> Hi All!
> 
> I need to substitute requested page with aniother, i. e. if client has reqested page http://arifolth/meat[anything].html 
> he should get http://arifolth/handbook.html
> as far as I understand reverse proxyfying is the only right way to do it
> mod rewrite alone works fine, it gave error 302 to the client  - the document has moved ...
> but I need to get not a redirection reply but the substituted page itself. when I`m trying to use mod_proxy things are gone bad: server`s answer is always 403 - Access forbidden!


---------------------------------------------------------------------
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] apache2 mod_rewrite + mod_proxy internal proxying problem

Posted by Axel-Stephane SMORGRAV <Ax...@europe.adp.com>.
You cannot use that combination of RewriteRule and ProxyPass. The fact is that ProxyPass actually gets the upper hand on RewriteRule. Furthermore you MUST specify the destination host in your RewriteRule when using the P flag. I would also drop the IfModule tests for any module which is necessary for the correct operation of your server.  It is better to get an error during initialisation clearly indicating that it will not work as intended.

Try the following configuration:

RewriteEngine On
RewriteLog rewrite.log
RewriteLogLevel 9
RewriteRule ^/meat(.*) http://arifolth/handbook.html [P,L]

ProxyRequests Off

ProxyPassReverse /handbook.html http://arifolth


-ascs

-----Message d'origine-----
De : Arifolth [mailto:arifolth@mail.ru] 
Envoyé : mardi 13 novembre 2007 15:37
À : users@httpd.apache.org
Objet : [users@httpd] apache2 mod_rewrite + mod_proxy internal proxying problem

Hi All!

I need to substitute requested page with aniother, i. e. if client has reqested page http://arifolth/meat[anything].html
he should get http://arifolth/handbook.html as far as I understand reverse proxyfying is the only right way to do it mod rewrite alone works fine, it gave error 302 to the client  - the document has moved ...
but I need to get not a redirection reply but the substituted page itself. when I`m trying to use mod_proxy things are gone bad: server`s answer is always 403 - Access forbidden!

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