HTTP 502 — Web server received an invalid response while acting as a gateway or proxy server — during the deployment process.

Steve Ellwood
1 min readOct 5, 2021

I have an IIS server farm that sits in front of two sites that are used in a blue/green configuration. Today I needed to update both sites in quick succession. Under normal circumstances this would not be a problem. Today however was not a normal day. After the first site was deployed it started returning the above error, though running the site locally from the server worked as expected.

Broadly speaking, my deployment process is to make the site unavailable gracefully on the farm (if needed), stop the site, delete the old files, deploy the new site, restart the site. In this particular case something went wrong and I’m still not sure what, I do however know what fixed it for me.

I simply turned the site on and off again by making it unavailable to the farm, then making it available again. This exact same occurred with the second deployment with the same fix. It hasn’t happened before that I recall so I suspect something has changed but I don’t yet know what.

Update Jan 2022

Please note that I have described how I resolved this issue when it was regularly occuring in this blog

--

--

Steve Ellwood

Senior Integrations Officer at Doncaster Council Any views expressed are entirely my own.