You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Jan P. Monsch" <ja...@csnc.ch> on 2003/01/10 10:46:56 UTC

Problem combining mod_proxy, mod_rewrite & mod_perl

G'day!

I would like to combine mod_proxy, mod_rewrite and mod_perl on an Apache 
2.0.43 for Windows with mod_perl 2.0. The Perl Version I use is 
ActiveState 5.6.1.

Just by loading the module the server behaves differently. Instead 
seeing the the reverse proxied site I get following error in the browser:

-----
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET 
/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/.

Reason: Max-Forwards has reached zero - proxy loop?
-----

It seems as if the rewrite rules are applied in a recursive loop. The 
rewrite.log does support this.

Any ideas why this is happening and how can I get the config running again.

Regards Jan



------
The rewrite log does look like this:
sid#4ade80][rid#484888/initial] (2) init rewrite engine with requested uri /
sid#4ade80][rid#484888/initial] (3) applying pattern '^/(.*)' to uri '/'
sid#4ade80][rid#484888/initial] (2) rewrite / -> /directx/
sid#4ade80][rid#484888/initial] (2) forcing proxy-throughput with 
http://192.168.X.X/directx/
sid#4ade80][rid#484888/initial] (1) go-ahead with proxy request 
proxy:http://192.168.X.X/directx/ [OK]
sid#4ade80][rid#48a8a0/initial] (2) init rewrite engine with requested 
uri /directx/
sid#4ade80][rid#48a8a0/initial] (3) applying pattern '^/(.*)' to uri 
'/directx/'
sid#4ade80][rid#48a8a0/initial] (2) rewrite /directx/ -> /directx/directx/
sid#4ade80][rid#48a8a0/initial] (2) forcing proxy-throughput with 
http://192.168.X.X/directx/directx/
sid#4ade80][rid#48a8a0/initial] (1) go-ahead with proxy request 
proxy:http://192.168.X.X/directx/directx/ [OK]
... { Shortend }


-----
I have following httpd.conf (shortend):
LoadFile "C:/Perl/bin/perl56.dll"

LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule perl_module modules/mod_perl.so

<VirtualHost 1192.168.X.X:81>
	ServerName      foo.bar
	DocumentRoot	/htdocs_rp
	
	RewriteEngine	On
	RewriteLog	logs/rewrite.log
	RewriteLogLevel	9

	RewriteRule	^/inject$	/tap1/inject.html [P]
	RewriteRule	^/(.*)	/directx1/$1 [P]

	ProxyPass	/tap1/		http://127.0.0.1/
	ProxyPassReverse	/	http://127.0.0.1/

	ProxyPass	/directx1/	http://acm.org/
	ProxyPassReverse	/	http://acm.org/
</VirtualHost>


Re: Problem combining mod_proxy, mod_rewrite & mod_perl

Posted by Stas Bekman <st...@stason.org>.
Jan P. Monsch wrote:
> G'day!
> 
> I would like to combine mod_proxy, mod_rewrite and mod_perl on an Apache 
> 2.0.43 for Windows with mod_perl 2.0. The Perl Version I use is 
> ActiveState 5.6.1.
> 
> Just by loading the module the server behaves differently. Instead 
> seeing the the reverse proxied site I get following error in the browser:
> 
> -----
> Proxy Error
> The proxy server received an invalid response from an upstream server.
> The proxy server could not handle the request GET 
> /directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/directx1/. 
> 
> 
> Reason: Max-Forwards has reached zero - proxy loop?
> -----
> 
> It seems as if the rewrite rules are applied in a recursive loop. The 
> rewrite.log does support this.
> 
> Any ideas why this is happening and how can I get the config running again.
[...]

 From your explanations and debug traces it looks like a bug in 
mod_proxy/mod_rewrite. You probably will get the same story with 
mod_cgi. If so, you need to report this bug to the httpd-dev list.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com