| Summary: | URI Fragments Cached After 301 Redirect | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | zachshaw1 |
| Component: | Page Loading | Assignee: | Brandon <brandonstewart> |
| Status: | RESOLVED FIXED | ||
| Severity: | Major | CC: | achristensen, beidson, brandonstewart, bugs-noreply, cdumez, koivisto, mcatanzaro, saralkaushik, simon.khalil, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 16 | ||
| Hardware: | All | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=257327 | ||
|
Description
zachshaw1
2023-04-25 08:12:04 PDT
I'm having this issue too. Strangely after a 301 the URL fragment is picking up cached values instead of the new fragment values. Very odd behaviour Was doing some testing and was able to reproduce back on Safari 16.2 and a recent version of Safari.
Testing
Redirect Server
from http.server import HTTPServer, BaseHTTPRequestHandler
class Redirect(BaseHTTPRequestHandler):
def do_GET(self):
print("hello")
self.send_response(301)
self.send_header('Location', 'http://localhost:8000')
self.send_header('Referrer-Policy', 'same-origin')
self.end_headers()
HTTPServer(('', 10000), Redirect).serve_forever()
##################
Server to redirect to
python3 -m http.server --bind 127.0.0.1 --directory . 8000
index.html
<!DOCTYPE html>
<html>
<p>Hello World</p>
</html>
URL
Go to localhost:10000/#key=foo
Then go to localhost:10000/#key=bar
I noticed it works correctly on the second time you visit the redirect.
URL Enter -> URL Result
localhost:10000/#key=foo -> localhost:8000/#key=foo
localhost:10000/#key=bar -> localhost:8000/#key=foo
localhost:10000/#key=bar -> localhost:8000/#key=bar
*** Bug 257327 has been marked as a duplicate of this bug. *** Seem information from dupe at https://bugs.webkit.org/show_bug.cgi?id=257327#c2 to help fix this. Odds are we simply want to stop caching redirects when the request URL contains a fragment. (In reply to Chris Dumez from comment #5) > Seem information from dupe at > https://bugs.webkit.org/show_bug.cgi?id=257327#c2 to help fix this. > > Odds are we simply want to stop caching redirects when the request URL > contains a fragment. It is not OK to navigate to https://www.monzo.com/#foo=bar, it is not OK to cache en entry like this: ``` https://www.monzo.com (because we drop fragment from cache keys) -> https://monzo.com/#foo=bar ``` Because this cached redirect would get reused for every load of https://www.monzo.com, no matter the fragment identifier. Pull request: https://github.com/WebKit/WebKit/pull/14514 Committed 265906@main (205444531ae8): <https://commits.webkit.org/265906@main> Reviewed commits have been landed. Closing PR #14514 and removing active labels. |