Chrome browser does not send 'If-None-Match' for xhr

I use the angular service to get the resource through rest api. The server sets the ETag header for some value, and also sets the Cache-Control: no-cache response in it.

This works as expected using Firefox, but when I access the same application through Chrome, it does not send If-None-Match . I tried existing Chrome and stable channels on both Mac and Ubuntu, and this was the same for both, while Firefox correctly added If-None-Match .

Now there are other non-xxx / static resources that are conditionally selected, and all of these requests correctly receive a 304 NOT MODIFIED response.

Is there anything I can do to get more information on why Chrome doesn't send an If-None-Match header for XHR requests only?

+7
google-chrome ajax etag
source share
1 answer

If you send an Ajax request to Chrome via HTTPS, any certificate errors, such as using a self-signed certificate on your API server, do not allow the response to be cached. It looks like a design.

Obviously, there is a defect in Chrome, but it was fixed in Webkit and turned into Chromium / Chrome in 2010.

Another question recommends manually adjusting the If-Modified-Since and If-None-Match headers using the jQuery ifModified: true and cache: true options. Unfortunately, this will not lead to excessive use of Chrome's behavior, so as not to cache HTTPS responses from a server with a self-signed certificate.

Testing on a server with a valid signed SSL certificate solved the problem for me; Chrome got 304 for text / html content, as expected, using standard jQuery AJAX methods.

+4
source share

All Articles