For 304 status code from services the gateway takes a long time to return response

I’ve implemented supporting If-Modified-Since header for my APIs (If-Modified-Since header - HTTP | MDN) within my web service and do notice that for the cases where the response had empty body esp., with status code 304 the gateway was responding after 6000ms :frowning: Not sure what can be done at the gateway policy to circumvent this

If you can reproduce this, you should take a trace to see what exactly is causing the latency. The trace will tell you which policy (or policies) are causing the delay and you can troubleshoot from there.

1 Like

We were running into this same issue with HTTP 204 and 304 responses from origin. The fix is to remove the Content-Encoding response header at origin when these status codes are sent. I’m assuming that Apigee opens a gzip reader when Content-Encoding is set but there are no response bytes in the body so the gzip reader times out after 30 seconds (in our case). Good luck!