Richard Williams2

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

Close

Q: server 5 proxy timeout settings

  • All replies
  • Helpful answers

Page 1 Next
  • by Bosco1983,

    Bosco1983 Bosco1983 Nov 12, 2015 3:17 AM in response to Richard Williams2
    Level 1 (61 points)
    Servers Enterprise
    Nov 12, 2015 3:17 AM in response to Richard Williams2

    thanks

  • by farbanalyse,

    farbanalyse farbanalyse Dec 2, 2015 6:44 AM in response to Richard Williams2
    Level 1 (0 points)
    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

  • by farbanalyse,

    farbanalyse farbanalyse Dec 2, 2015 7:35 AM in response to farbanalyse
    Level 1 (0 points)
    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

  • by farbanalyse,

    farbanalyse farbanalyse Dec 3, 2015 12:07 AM in response to farbanalyse
    Level 1 (0 points)
    Dec 3, 2015 12:07 AM in response to farbanalyse

    i'm sorry, the parameter 'ProxyTimeout=300' is wrong and leads to an error.

  • by Bunnyfu,

    Bunnyfu Bunnyfu Dec 14, 2015 11:40 AM in response to Richard Williams2
    Level 1 (0 points)
    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...

  • by Bunnyfu,

    Bunnyfu Bunnyfu Dec 15, 2015 12:57 AM in response to Bunnyfu
    Level 1 (0 points)
    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!

  • by Bosco1983,

    Bosco1983 Bosco1983 Dec 15, 2015 1:46 AM in response to Bunnyfu
    Level 1 (61 points)
    Servers Enterprise
    Dec 15, 2015 1:46 AM in response to Bunnyfu

    I'll give this a go now, thank you.

  • by Bosco1983,

    Bosco1983 Bosco1983 Dec 15, 2015 2:20 AM in response to Bunnyfu
    Level 1 (61 points)
    Servers Enterprise
    Dec 15, 2015 2:20 AM in response to Bunnyfu

    I feel those settings certainly helped.  Profile Manager stays up longer now before I get the error message.  Would increasing the ProxyTimeout value to something higher than 300 possibly help me further? 

     

     

    Many thanks for the info Bunnyfu - profile  manager has been driving me nuts for months!

  • by Bunnyfu,

    Bunnyfu Bunnyfu Dec 15, 2015 2:40 AM in response to Bosco1983
    Level 1 (0 points)
    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.

  • by Bosco1983,

    Bosco1983 Bosco1983 Dec 15, 2015 3:14 AM in response to Bunnyfu
    Level 1 (61 points)
    Servers Enterprise
    Dec 15, 2015 3:14 AM in response to Bunnyfu

    I've set to 400 for now and see what happens.  Shame profile manager is so flaky on server 5 - lets hope Apple patch this and get things sorted!

  • by Bosco1983,

    Bosco1983 Bosco1983 Dec 15, 2015 7:56 AM in response to Bosco1983
    Level 1 (61 points)
    Servers Enterprise
    Dec 15, 2015 7:56 AM in response to Bosco1983

    400 seemed to make PM slow down too much (unless this was a coincidence with another problem).  I now have the setting at 200 and although I get the odd crash, its a LOT less frequent than before.

    Thanks again for the info - certainly helped!

  • by Bosco1983,

    Bosco1983 Bosco1983 Dec 17, 2015 3:16 AM in response to Bosco1983
    Level 1 (61 points)
    Servers Enterprise
    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.

  • by Bosco1983,

    Bosco1983 Bosco1983 Jan 8, 2016 1:45 AM in response to Bosco1983
    Level 1 (61 points)
    Servers Enterprise
    Jan 8, 2016 1:45 AM in response to Bosco1983

    further update - 200 was leading to crashes once our estate got busy.  setting currently at 350. slow but more stable

  • by 4nNtt,

    4nNtt 4nNtt Jan 8, 2016 5:38 AM in response to Bosco1983
    Level 1 (0 points)
    Jan 8, 2016 5:38 AM in response to Bosco1983

    Thank you Bunnyfu and Bosco1983.  This is a good temporary workaround.  Those stored procedures are still causing it to run very slow, but at least the error dialog box isn't getting in the way.

     

    If it starts slowing down, wait until everything shows idle after running this command before continuing:

     

    sudo psql -U _devicemgr -d devicemgr_v2m0 -h /Library/Server/ProfileManager/Config/var/PostgreSQL -c "select state,query from pg_stat_activity;"

Page 1 Next