Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apache reverseproxy timeouts exactly after 60 secs

I have Apache Reverse proxy server which proxies request to my internal Apache server. I am using Apache version 2.4 on Linux platform.

I encountered timeout page and HTTP ERROR 504 whenever back-end Apache server is taking more than 60 seconds ( PHP page waiting for results from Mysql query on back-end Apache server)

Apache Default timeout is set to 300 seconds.

This issue comes only when accessing website through apache reverse proxy. It works well by using internal IP.

I have tried to set below parameters to proxypass but no luck.

ProxyPass / http://internal-ip:8080/ retry=1 acquire=3000 timeout=600 Keepalive=On

I have also tried to ProxyPass on non existing IP which is also showing 504 HTTP ERROR after 60 seconds

Please help me to understand this issue.

<VirtualHost *:80>
 ServerName mywebsite.example.com
 ServerAlias www.mywebsite.example.com
 ProxyPreserveHost On
 DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/mywebsite.example.com-error.log
        CustomLog ${APACHE_LOG_DIR}/mywebsite.example.com-access.log combined

 RewriteCond %{REQUEST_METHOD} !^(GET|POST)$
 RewriteRule .* - [R=405,L]
 ProxyPass /.static-pages !
 ProxyPass / http://<Internal Apache Server IP>/
 ProxyPassReverse / http://<Internal Apache Server IP>/
</VirtualHost>
like image 850
Jayesh Labade Avatar asked May 13 '26 19:05

Jayesh Labade


1 Answers

I had exact same problem and solved this way:

ProxyRequests off
    Timeout 600
    ProxyTimeout 600
    <Proxy balancer://Mycluster>
        BalancerMember http://url:80
        ProxySet lbmethod=byrequests timeout=600
    </Proxy>
    ProxyPass / balancer://Mycluster/ timeout=600
like image 153
Selman K. Avatar answered May 15 '26 08:05

Selman K.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!