Bug 114517
Summary: | Webkit reuses cache with different headers | ||
---|---|---|---|
Product: | WebKit | Reporter: | Omar Ajoue <krynble> |
Component: | History | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | ap, beidson, koivisto |
Priority: | P2 | ||
Version: | 525.x (Safari 3.2) | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
URL: | http://br.kekanto.com/search?&c=269853&m=c&lat=-23.548547000&lng=-46.638272000&q=pizza&near=S%C3%A3o+Paulo |
Omar Ajoue
In order to reproduce this bug you should follow the following steps:
1) browse the following url: http://br.kekanto.com/search?&c=269853&m=c&lat=-23.548547000&lng=-46.638272000&q=pizza&near=S%C3%A3o+Paulo
It shows a list of places selling pizza in Sao Paulo.
2) Click either the star rating filter or price range (star and dolar signs respectively; NOTE: these are anchor tags <a>).
The pages reloads using AJAX and the new results are shown. I use pushState to create a new URL entry.
3) Navigate away from the page (like clicking a place name)
4) Press the back button
The expected result should be the same listing as before, but the actual result is a JSON.
Problem is: The URL pushed in the pushState is the same as Web Service used to populate the page. The browser considers it has a copy of the page and serves it, but that is a JSON. The same URL, if requested with the X-Requested-With: XMLHTTPRequest brings a JSON instead.
NOTE:
If you click a checkbox in the page it triggers the EXACT same reload function, but this does not cause the problem. Only happens only when browsing using anchor tags that change the underlying form and trigger a submit via AJAX.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Brady Eidson
If I understand this report correctly, you're saying that you wished WebKit would not look up a request to this URL in its cache if the value of the X-Requested-With header differs?
If so, try making your server reply to requests for this URL respond with "Vary: X-Requested-With".
Omar Ajoue
Thanks a lot Brady for your answer, this really solved the problem - I tried adding the response header Content-type: application/json but it still kept showing the JSON file instead of a page.
Now with the Vary header everything works as expected.