502 Proxy Errors between IIS and Apache2
I see this question has been around for a while, so I thought I would throw in my 2 cents. More of my experience anyways...
As far as I am aware those three env variables or settings are ok in production. Your understanding of them is correct also. When I had this problem way back I found this link to be usefull in the explaination of the problem. It only occurrs with IIS in the backend.... Just note that the intial pooled setting will impact performance expecially in Http/1.0 clients... I have never noticed anything, however, the iis server alone has 64gb of ram and several cores on the machine... so I admit I can't be sure that 'it does not impact at all', all I know is that 'with enough resources you don't have a problem'...
To be honest but, re your toothpick statement, I know of dozens of production environments that implement this... You can set other things and play around with apache and change it to implement longer timeouts etc, but I have set these settings and it just works...
I guess I just wanted to say that you shouldn't loose any sleep over these settings. In my opinion, whilst I don't know if they are best practices, they are safe...
Sorry I can't help more...
Cheers Robin
user1026361
Updated on June 09, 2022Comments
-
user1026361 almost 2 years
I am currently running
apache2
on aSUSE
instance@EC2
. As part of my site, my data usesmod_proxy
to hit aREST
server runningIIS
viaProxy/ReverseProxy
.After setting up my
vhosts
, enablingmod_proxy
and establishing my config, I found that I was frequently encountering502
errors. These errors were of theProxy Error
andBad Gateway
flavour. After doing some considerable google, I found that there was a difference in the wayIIS
andapache
terminate their connections which was causing the error. After setting the following environment variables, performance has improved markedly:SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1What I'm wondering is why this works and what an ideal configuration would look like.
Is my understanding that, with the Env variables:
I am forcing anHTTP 1.0 request
(which will standardize the termination expectaions)
NOT keeping alive any connections
NOT using any pooled connections
correct?What if I need to use pooled connections? What if I want to use keep-alives? In short, I'm looking for best practices to replace the toothpick and glue solution I'm currently using