You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alexey Vlasov <re...@renton.name> on 2008/01/30 05:34:57 UTC

[users@httpd] ProxyTimeout and mod_rewrite proxy request

Hi,

Hi,

I use Apache 2.2.8 (2.2.6) worker mpm as frontend proxy server for
working up static requests.
And Apache 2.2.3 mpm prefork (as backend) with mod_php serves to work
up
dynamic requests, in this case, for PHP scripts.

I separate static from dynamic in worker with simple rules mod_rewrite,
for example:
...
RewriteCond %{HTTP_HOST} ([^/:]*)(.*)
RewriteRule ^([^?]*)\.php(.*)$ http://%1:8080%{REQUEST_URI} [NC,L,P]
...

When backend doesn't answer on requests, frontend returns to the client
an error 502 Proxy Error.

I want to increase timeout for getting this error. I tried to use
Timeout 300, ProxyTimeout 300 in httpd.conf, but it didn't bring any
result, timeout is 180 seconds.
I check it this way:

$ cat sleep.php
<?php ini_set ('max_execution_time', '3600'); sleep (600); ?>

$ time wget -T 3600 http://test-apache.hu/sleep.php
--21:23:42--  http://test-apache.hu/sleep.php
           => `sleep.php'
Resolving test-apache.hu... 111.222.222.111
Connecting to test-apache.hu|111.222.222.111|:80... connected.
HTTP request sent, awaiting response... 502 Proxy Error
21:26:43 ERROR 502: Proxy Error.

real    3m1.556s
user    0m0.000s
sys     0m0.004s

Does anyone have ideas what the timeout is and how to increase it?

-- 
BRGDS. Alexey Vlasov.

---------------------------------------------------------------------
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] ProxyTimeout and mod_rewrite proxy request

Posted by Christian Folini <ch...@post.ch>.
On Wed, Jan 30, 2008 at 10:29:33PM +0300, Alexey Vlasov wrote:
> My config is rather simple, everything is set by default.

Cut down the default. You are hunting a config error or bug,
so you need to get the smallest sample, that triggers your
timing error. So go wtih a single file httpd.conf
(-> Start with including all the Include files into one big
one). Then remove config snippets one by one or in groups.
Always testing again. Remove modules. Especially remove
PHP, SSL and KeepAlive. Then when you have ironed out the
error, slowly up your final configuration again, but
only those parts you really need.

Takes a bit of time, but usually, it works - and teaches you a
lot about apache.

Christian


-- 
Christian Folini, Swiss Post IT, Unix / Apache Engineering
+41 (0)58 338 79 96               christian.folini@post.ch

---------------------------------------------------------------------
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] ProxyTimeout and mod_rewrite proxy request

Posted by Alexey Vlasov <re...@renton.name>.
Hi Christian!

Thanks for your answer.

My config is rather simple, everything is set by default.

Here is also:
# grep -ri timeout /etc/apache_aux2/ | grep -v original

/etc/apache_aux2/extra/httpd-default.conf:# Timeout: The number of
seconds before receives and sends time out.
/etc/apache_aux2/extra/httpd-default.conf:Timeout 300
/etc/apache_aux2/extra/httpd-default.conf:# KeepAliveTimeout: Number of
seconds to wait for the next request from the
/etc/apache_aux2/extra/httpd-default.conf:KeepAliveTimeout 5
/etc/apache_aux2/extra/httpd-ssl.conf:#   to use and second the expiring
timeout (in seconds).
/etc/apache_aux2/extra/httpd-ssl.conf:SSLSessionCacheTimeout  300
/etc/apache_aux2/extra/httpd-mpm.conf:#    IdleTimeout           60
/etc/apache_aux2/extra/httpd-mpm.conf:#    ExpireTimeout        300
/etc/apache_aux2/httpd.conf:ProxyTimeout 300

# grep httpd-default.conf /etc/apache_aux2/httpd.conf
Include /etc/apache_aux2/extra/httpd-default.conf

May be you have some more ideas? Thnx in advance.

On Wed, Jan 30, 2008 at 07:56:21AM +0100, Christian Folini wrote:
> Hey Alexey,
> 
> There is an issue with ProxyTimeout in Apache 2.0, but
> Apache 2.2 seemed to work as advertised when I ran
> tests a few months back. Your results look strange to me.
> 
> My setup was very similar to yours, but I used netcat
> as application server. 
> 
> application server:
> 	netcat -l -p 8080
> and on the client: 
> 	netcat hostX 80 < /tmp/get-request
> 
> Then run tcpdump to see all packets flying between the hosts/ports.
> 
> I suggest you cut down your config as much as you can and
> make sure there are no other timeout settings anywhere.
> 
> regs,
> 
> Christian
> 
> 
> On Wed, Jan 30, 2008 at 07:34:57AM +0300, Alexey Vlasov wrote:
> > Hi,
> > 
> > Hi,
> > 
> > I use Apache 2.2.8 (2.2.6) worker mpm as frontend proxy server for
> > working up static requests.
> > And Apache 2.2.3 mpm prefork (as backend) with mod_php serves to work
> > up
> > dynamic requests, in this case, for PHP scripts.
> > 
> > I separate static from dynamic in worker with simple rules mod_rewrite,
> > for example:
> > ...
> > RewriteCond %{HTTP_HOST} ([^/:]*)(.*)
> > RewriteRule ^([^?]*)\.php(.*)$ http://%1:8080%{REQUEST_URI} [NC,L,P]
> > ...
> > 
> > When backend doesn't answer on requests, frontend returns to the client
> > an error 502 Proxy Error.
> > 
> > I want to increase timeout for getting this error. I tried to use
> > Timeout 300, ProxyTimeout 300 in httpd.conf, but it didn't bring any
> > result, timeout is 180 seconds.
> > I check it this way:
> > 
> > $ cat sleep.php
> > <?php ini_set ('max_execution_time', '3600'); sleep (600); ?>
> > 
> > $ time wget -T 3600 http://test-apache.hu/sleep.php
> > --21:23:42--  http://test-apache.hu/sleep.php
> >            => `sleep.php'
> > Resolving test-apache.hu... 111.222.222.111
> > Connecting to test-apache.hu|111.222.222.111|:80... connected.
> > HTTP request sent, awaiting response... 502 Proxy Error
> > 21:26:43 ERROR 502: Proxy Error.
> > 
> > real    3m1.556s
> > user    0m0.000s
> > sys     0m0.004s
> > 
> > Does anyone have ideas what the timeout is and how to increase it?
> > 
> > -- 
> > BRGDS. Alexey Vlasov.
> > 
> > ---------------------------------------------------------------------
> > 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
> 

-- 
BRGDS. Alexey Vlasov.

---------------------------------------------------------------------
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] ProxyTimeout and mod_rewrite proxy request

Posted by Christian Folini <ch...@post.ch>.
Hey Alexey,

There is an issue with ProxyTimeout in Apache 2.0, but
Apache 2.2 seemed to work as advertised when I ran
tests a few months back. Your results look strange to me.

My setup was very similar to yours, but I used netcat
as application server. 

application server:
	netcat -l -p 8080
and on the client: 
	netcat hostX 80 < /tmp/get-request

Then run tcpdump to see all packets flying between the hosts/ports.

I suggest you cut down your config as much as you can and
make sure there are no other timeout settings anywhere.

regs,

Christian


On Wed, Jan 30, 2008 at 07:34:57AM +0300, Alexey Vlasov wrote:
> Hi,
> 
> Hi,
> 
> I use Apache 2.2.8 (2.2.6) worker mpm as frontend proxy server for
> working up static requests.
> And Apache 2.2.3 mpm prefork (as backend) with mod_php serves to work
> up
> dynamic requests, in this case, for PHP scripts.
> 
> I separate static from dynamic in worker with simple rules mod_rewrite,
> for example:
> ...
> RewriteCond %{HTTP_HOST} ([^/:]*)(.*)
> RewriteRule ^([^?]*)\.php(.*)$ http://%1:8080%{REQUEST_URI} [NC,L,P]
> ...
> 
> When backend doesn't answer on requests, frontend returns to the client
> an error 502 Proxy Error.
> 
> I want to increase timeout for getting this error. I tried to use
> Timeout 300, ProxyTimeout 300 in httpd.conf, but it didn't bring any
> result, timeout is 180 seconds.
> I check it this way:
> 
> $ cat sleep.php
> <?php ini_set ('max_execution_time', '3600'); sleep (600); ?>
> 
> $ time wget -T 3600 http://test-apache.hu/sleep.php
> --21:23:42--  http://test-apache.hu/sleep.php
>            => `sleep.php'
> Resolving test-apache.hu... 111.222.222.111
> Connecting to test-apache.hu|111.222.222.111|:80... connected.
> HTTP request sent, awaiting response... 502 Proxy Error
> 21:26:43 ERROR 502: Proxy Error.
> 
> real    3m1.556s
> user    0m0.000s
> sys     0m0.004s
> 
> Does anyone have ideas what the timeout is and how to increase it?
> 
> -- 
> BRGDS. Alexey Vlasov.
> 
> ---------------------------------------------------------------------
> 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