我使用PHP构建了一些简单的GET
webservice,返回一些JSON。我已在我的本地测试和缓存工作完全正常。但是当我部署到Heroku时,缓存简单不起作用。
我做了一些测试,服务器返回完全正常的所有缓存标头:
Heroku 标题回复来自AFNetworking:
"Cache-Control" = "public, max-age=86400";
Connection = "keep-alive";
"Content-Type" = "application/json";
Date = "Sat, 20 Jun 2015 05:10:20 GMT";
Server = "Apache/2.4.10 (Unix)";
"Transfer-Encoding" = Identity;
Via = "1.1 vegur";
"X-Powered-By" = "PHP/5.6.10";
来自AFNetworking的本地服务器标头:
"Cache-Control" = "public, max-age=86400";
Connection = "Keep-Alive";
"Content-Length" = 1711;
"Content-Type" = "application/json";
Date = "Sat, 20 Jun 2015 05:11:39 GMT";
"Keep-Alive" = "timeout=5, max=98";
Server = "Apache/2.4.10 (Unix) OpenSSL/1.0.1j PHP/5.6.3 mod_perl/2.0.8-dev Perl/v5.16.3";
"X-Powered-By" = "PHP/5.6.3";
此外,NSCachedURLResponse
始终从我的Heroku网址返回nill。
有没有人对此有任何想法?
顺便说一句:使用iOS 8.3 SDK。