Bug 247942 - Evaluate what happens to application specific HTTP headers in case of 301 cached redirections
Summary: Evaluate what happens to application specific HTTP headers in case of 301 cac...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-15 04:48 PST by youenn fablet
Modified: 2022-11-16 23:47 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2022-11-15 04:48:23 PST
Evaluate what happens to application specific HTTP headers in case of 301 cached redirections.
We should probably use the request application specific headers, and not the cached headers.
Comment 1 youenn fablet 2022-11-15 04:49:25 PST
See https://bugs.webkit.org/show_bug.cgi?id=247418.
I wonder whether we should actually store redirect request in the HTTP cache.
Maybe we should just store the location URL, and then recompute dynamically the redirect request from the new request and the location URL.
This would allow preserving the new request headers
Comment 2 Radar WebKit Bug Importer 2022-11-15 04:49:43 PST
<rdar://problem/102362992>
Comment 3 youenn fablet 2022-11-16 05:44:41 PST
Pull request: https://github.com/WebKit/WebKit/pull/6549
Comment 4 Anne van Kesteren 2022-11-16 08:06:38 PST
As far as I know per HTTP the idea is that the response is cached, not the request. Why are we storing the request?

As for what headers to preserve from the request: Fetch preserves them all, though it was recently tweaked slightly to drop a number of headers when the request method changed.

https://github.com/whatwg/fetch/issues/944 is still open to drop the Authorization header when another origin is reached. I guess pushing for that now that there's at least one implementation and no known compatibility fallout is a good idea. I can try to make time for that.
Comment 5 youenn fablet 2022-11-16 23:47:28 PST
CFNetwork provided the redirected request, that might explain the current approach (use it and store it), but it is not always aligned with what we want.
We have ResourceRequest::redirectedRequest which is used to generate the redirected request in case of service worker redirection. We could move towards using this for all ports.