Friday, June 27, 2014

IIS ARR Reverse Proxy and HTTP Status Code 304

In IIS 7.5, reverse proxy using ARR v2, does not send 304 status code for subsequent requests which are cached on file system. Because of this, even if the actual website allows caching of requests in browser (client side), ARR always sends HTTP 200 code. This forces the browser to download the cached request again from server.

For some strange reason, ARR always send status code 200 if requests contains ETags.
So, basically if you want ARR to send 304 status code then ETags must be removed.

In IIS, Etags can be removed from response with the help IIS URL Rewrite module. Following outbound rule must be created to remove ETags:

<outboundrules>
  <rule name="Remove ETag">
    <match pattern=".+" servervariable="RESPONSE_ETag">
    <action type="Rewrite" value="">
  </action></match></rule>
</outboundrules>

For more details check below links:
http://stackoverflow.com/questions/24381694/iis-7-5-and-arr-304-status-code-not-sent-for-images
http://forums.iis.net/t/1213330.aspx?ARR+Disk+cache+return+200+instead+of+304+for+cached+files

No comments:

Post a Comment