NetScaler handling a HTTP 304 Not-modified Responses
book
Article ID: CTX233721
calendar_today
Updated On:
Description
Website access via NetScaler LB seem to be working fine for some webpages while other pages with Widgets/ images doesn't seem to load after accessing the page subsequent times. Accessing the page first time works as the server responds with HTTP 200OK. Subsequent access the server responds with HTTP 304 Not-Modified to which NetScaler is sending TCP-RST.
Resolution
- Check why backend server is sending “null” in the 304 Not Modified response and make the server not to send anything in body of 304 response.
- As a workaround please make following settings on the HTTP profile used in the configuration.
Enable Drop extra CRLFEnable Drop extra data from serverDisable Drop invalid HTTP requests
In case no HTTP profile is bound then edit the default profile for above settings:
3. Create following rewrite rule on NetScaler so that we delete the “If-Modified-Since” header coming from the client and then sending to backend server. So that backend server does not reply with 304 response.add rewrite action delete-if-none-match delete_http_header If-Modified-Since
add rewrite policy rewrite-pol-header "HTTP.REQ.HOSTNAME.EQ(\"<FQDN>\")" delete-if-none-match
Problem Cause
304 response coming from backend is containing extra character (null) after \r\n\r\n, This behavior of the backend server is not RFC complaint. GET /widgetId=3 HTTP/1.1Host: <citrix>Connection: keep-aliveAccept: application/json, text/javascript, */*X-Requested-With: XMLHttpRequestUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36Content-Type: application/x-www-form-urlencodedReferer: Accept-Encoding: gzip, deflateAccept-Language: nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7If-Modified-Since: Wed, 21 Dec 2016 14:14:39 GMT << See if we can drop GET request if request contains If-Modified-Since header as a workaround HTTP/1.1 304 Not ModifiedCache-Control: privateContent-Type: text/html; charset=utf-8Server: Microsoft-IIS/8.5x-frame-options: SAMEORIGINX-Powered-By: ASP.NETX-UA-Compatible: IE=edgeDate: Thu, 15 Mar 2018 13:18:51 GMTnull << 304 shall not contain body, see if we can fix backend server to eliminate ‘null’ body
Issue/Introduction
Website access via NetScaler LB seem to be working fine for some webpages while other pages with Widgets/ images doesn't seem to load properly
Additional Information
From RFC (https://tools.ietf.org/html/rfc7232#section-4.1): 4.1. 304 Not Modified The 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition evaluated to false. In other words, there is no need for the server to transfer a representation of the target resource because the request indicates that the client, which made the request conditional, already has a valid representation; the server is therefore redirecting the client to make use of that stored representation as if it were the payload of a 200 (OK) response. A 304 response cannot contain a message-body; it is always terminated by the first empty line after the header fields.
Was this article helpful?
thumb_up
Yes
thumb_down
No