I have an API written in Python which I am accessing with IIS 7.5 via the ISAPI extension PyISAPIe. I thought it would be sensible to separate this API from our main site, so it is in a different site accessed with port 8008.
To be able to access the API with URL like
http://domain/api, I have created a reverse proxy rule in IIS with ARR and URL Rewrite so that
http://domain/api is redirected to
The reverse proxy seems working correctly and I am receiving the correct responses from the API in most cases (the API returns JSON). However, in some cases, I am getting
502 errors with the following message:
502 - Web server received an invalid response while acting as a gateway or proxy server.
This seems to be happening only when the JSON response is above a certain size (about 125KB in my tests) - for smaller sizes, everything seems to be working correctly.
I've tried increasing the
Response buffer threshold in the proxy settings to no effect.
In the logs I can see that the requests to the site on port 8008 are succeeding and are returning a 200 status code.
After activating Failed Request Tracing, the only error/warning is the following (this is after recieving the response from the other site - see previous point) :
MODULE_SET_RESPONSE_ERROR_STATUS Warning ModuleName="ApplicationRequestRouting", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="502", HttpReason="Bad Gateway", HttpSubStatus="3", ErrorCode="2147954552"ConfigExceptionInfo=""