开发者

Stale JSON get data from Chrome/Safari on my Apache/Django server, but Firefox is never stale?

I have a Django 1.1 Apache2 server running. There is a JSON get request at a fixed URL that returns "stale" data when accessed via iPad/iPhone/Safari/Chrome, but is always up to date from Firefox.

By stale data, I mean that as the data the JSON represents changes, the broken requests don't get updated, their responses are getting cached for up to 15 minutes or so. Firefox always triggers the latest data, but Safaria/Chrome (iPad/iPhone) take up to 15 minutes to get the n开发者_StackOverflowewer data from that JSON request (they are returning a cached version.)

I can verify that Apache is putting in the access.log an entry for every single request no matter what browser, but the Django/Python code for the view is only getting called for Firefox requests each time. If the request comes from Safari/Chrome/iPad/iPhone the Django code is only getting called once every 15 minutes or so and the data is being cached.

My goal would be to turn off any cache'ing that is going on from any browser so the data is always the most up to date.


The problem was Django's cache middleware. I had it turned on for default local memory caching of anonymous webpages which before always had been static pages. But this JSON API (because of iPad/iPhone usage) was anonymous but had non-static data that changed over time. I don't know why FF triggered refreshes where the others did not. Disabling caching on anonymous pages fixed the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜