Skip to content

fix: Commit request prior to cache lookup when using guest caching - #1536

Open
TartanLlama wants to merge 6 commits into
mainfrom
sy/vary-header
Open

fix: Commit request prior to cache lookup when using guest caching#1536
TartanLlama wants to merge 6 commits into
mainfrom
sy/vary-header

Conversation

@TartanLlama

Copy link
Copy Markdown
Contributor

Currently, headers are not committed prior to transaction_lookup calls when using guest caching. As a result, if any headers are set that are marked as part of a Vary header on a cached origin response, the cache lookup does not take them into account. This PR ensures that headers are committed in time.

@TartanLlama

TartanLlama commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@cceckman-at-fastly do you think you could have a look at this and tell me if this is the right place to make the hostcalls necessary to update headers when using guest caching?

@TartanLlama TartanLlama changed the title fix: Vary headers for guest caching fix: Commit request prior to cache lookup when using guest caching Jul 30, 2026
@TartanLlama

Copy link
Copy Markdown
Contributor Author

Fixes #1178

@cceckman-at-fastly
cceckman-at-fastly self-requested a review July 30, 2026 20:25
bool is_cacheable = false;
{
auto request_handle = Request::request_handle(request);
auto res = request_handle.is_cacheable();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming fetch_send_body above flushes the headers for the non-guest-caching cases:

I think we need to make sure the host & guest are in sync as of this call, which should map to the is_request_cacheable hostcall. There are some things the RFC says about how the Authorization header affects cacheability ("it's complicated" but we want to be sure we have the data here) -- and if they have changed the method, that plays in to it as well.

That touches on my other thought: is commit_headers just headers, or is it also method & URI? We should make sure those are flushed as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants