NSURLCache and ETags with gzip enabled don't work

I'm trying to get NSURLCache to work on iOS8 but it seems to be corrupted when using ETag and gzip compression. I am using NGINX with gzip compression as a proxy for a thin web server. The following request is not cached by NSURLCache:

HTTP/1.1 200 OK
Server            nginx/1.7.6
Date              Thu, 06 Nov 2014 14:28:50 GMT
Content-Type      application/json;charset=utf-8
Transfer-Encoding chunked
Connection        keep-alive
Vary              Accept-Encoding
Cache-Control     private, max-age=0
ETag              W/"d693ff4d26d0e7f25498ecb89d8796cd41e9da4f"
Content-Encoding  gzip

      

When I disable gzip in NGINX config, the request is cached correctly:

HTTP/1.1 200 OK
Server         nginx/1.7.6
Date           Thu, 06 Nov 2014 14:26:40 GMT
Content-Type   application/json;charset=utf-8
Content-Length 311433
Connection     keep-alive
Cache-Control  private, max-age=0
ETag           W/"d693ff4d26d0e7f25498ecb89d8796cd41e9da4f"

      

I tried to set Cache-Control to public, but it didn't help.

My setting with gzip enabled works fine on iOS7.

Does anyone have an idea what I am doing wrong? Or do I need to submit a radar for this?

Thank you in advance

+3


source to share


1 answer


Sorry, I cannot comment, there is no reputation.



You can try to delete all -gzip

ETag entries. Here's what works for my own caching mechanism. Actually, I was looking for a suitable way to say to NSURLSession

use gzip ETags. This looks like a workaround.

0


source







All Articles