Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

server 5 proxy timeout settings

I recently upgraded to Server 5.0.4 and then to 5.0.15. I host a number of websites and one of them uses an external server to obtain data and this can take a few minutes, depending on the search requested. This ran fine on previous versions of server but I was getting error 502 on Server 5.0.x due to the reverse proxy timing out before the external server had responded. On Server 5.0.4 I tried to avoid this by setting up a second Wi-Fi connector and setting Apache to listen for port 80 on the extra IP address and this worked. However as soon as I upgraded to 5.0.15, my settings were overwritten again and I was back to square one. It took me quite a long time to find a solution having tried adding ProxyTimeout statements in various places to no avail. Here's what finally worked for me.

In /library/server/Web/Config/proxy/apache_serviceproxy.conf I modified the generic ProxyPass statement right at the end of the VirtualHost *:80 section to add a timeout as follows:
ProxyPass / http://127.0.0.1:34580/ timeout=300
and this increased the default timeout to 5 minutes (300 seconds).

I hope this might help someone else with the same problem.

Mac mini, OS X El Capitan (10.11.1), Server 5.0.15

Posted on Nov 10, 2015 6:48 AM

Reply
27 replies

Apr 11, 2017 4:22 AM in response to GACN

Moving on to Server 5.3 and this has been changed again. The apache_serviceproxy_customsites.conf just contains some Use statements that refer back to a <Macro section in apache_serviceproxy.conf. Open /Library/Server/Web/Config/Proxy/apache_serviceproxy.conf and look for the <Macro section for virtual hosts on port 80 and make your ProxyPass changes there.

Oct 3, 2017 7:12 AM in response to rvwilliams88

I've now decided that the easiest way to avoid having to make changes with every new version of Server, is to run the website on a different port, say 81. By running on a different port the website isn't using the proxy server at all. If any changes are required to the configuration, these can be put in a new .conf file and then you can define a very simple webapp. See the man pages for webapp.plist. If you are accessing the site from outside your firewall, you need to forward your new port to the MacOS server.

Dec 2, 2015 6:44 AM in response to Richard Williams2

Many thanks for your post.

I entounter the same error, but your solution doesn't work for me (I think) because we are delegating a subdomain to another machine/IP.

I tried to add the timeout also to the corresponding .conf file without success:

/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34580_subdomain.domain. com.conf

Maybe someone a solution for that? Many thanks in advance!



OS X El Capitan (10.11.1), Server 5.0.15

Dec 2, 2015 7:35 AM in response to farbanalyse

Solved it!

my current setting contains also a keepalive, ttl and ProxyTimeout parameter (might be redundant):

ProxyPass / http://subdomain.domain.com/ timeout=300 keepalive=On ttl=300 ProxyTimeout=300


added in

/library/server/Web/Config/proxy/apache_serviceproxy.conf

as well as

/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34580_subdomain.domain.c om.conf

Dec 14, 2015 11:40 AM in response to Richard Williams2

Added the following to /library/server/Web/Config/proxy/apache_serviceproxy.conf into the virtual hosts *80 sections:

ProxyPass / http://localhost/ timeout=900


After rebooting the server websites were not responding, which lead me to the conclusion that the config was in conflict witht something and preventing Apache webserver from launching.


Reverted the changes for now... Still trying to find a solution to scripts timing out. I have plenty of cron jobs launching lengthy scripts that take 5-10 minutes to fetch data from the Internet...

Dec 15, 2015 12:57 AM in response to Bunnyfu

Ok, I have found the solution. It is enough to simply add one line to the config file.


1. sudo nano /library/server/Web/Config/proxy/apache_serviceproxy.conf

2. Find: <VirtualHost *:80>

3. Add on a new line below: ProxyTimeout 300

4. Find: <VirtualHost *:443>

5. Add on a new line below: ProxyTimeout 300


Save and restart server. Fixed the 502 proxy error for me!

Dec 15, 2015 2:40 AM in response to Bosco1983

If your script takes more than 300 seconds, definitely increase the timeout. My scripts completely stopped timing out, because they are done in 3-4 minutes. I dont know how the server will react if you give it an insane timeout like 9999, but its worth a shot. 🙂 Its also worth checking the mod_proxy documentation to see if you can jus set the timeout to 0 for infinitey.

Dec 17, 2015 3:16 AM in response to Bosco1983

Just to update, I now have the timeout setting at 200 and although PM is a little slower, its DEFINITELY more stable than before.

I have also disabled APN and Internet Reachability which has lowed the CPU load with the postgres_real service. (I dont believe we need internet reachability to be on in our network as we have a NAT rule in place for external comms)


Many thanks to Bunnyfu for the timeout modification which certainly made the biggest difference.

server 5 proxy timeout settings

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.