Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Worker: fetch credentialless to play more nicely with server caches (#1311) #1311

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

brandonpayton
Copy link
Member

Let's stop sending cookies by default with requests for static files. The presence of cookies causes our new host to abort caching static files at the edge. And this can cause the same issue with other caches as well.

This only applies to requests from the Service Worker. There are still requests for static files with cookies from the browser, but this will at least reduce the number of cookied-requests.

Testing Instructions

  • Open a new tab in Safari
  • Open dev tools with networking tab selected
  • npm run dev
  • Load the dev site on Safari
  • Close the "Experimental" notice which remembers the closure using a cookie.
  • Reload the site.
  • In the dev tools Application tab, confirm there is a hideExperimentalNotice cookie for the test site.
  • In the dev tools Network tab, filter for .css files. Find a request that says "Source: Service Worker" and confirm that the request headers do not include a Cookie header.

NOTE:

  • We cannot use Chrome to test in this way because it just shows provisional request headers in dev tools
  • We cannot use Firefox to test with npm run dev because the dev version of the Service Sorker is a module and Firefox doesn't support modules as Service Workers.

Let's stop sending cookies by default with requests for static
files. The presence of cookies causes our new host to abort caching
static files at the edge. And this can cause the same issue with
other caches as well.
@adamziel adamziel merged commit 3023e5b into trunk Apr 23, 2024
5 checks passed
@adamziel adamziel deleted the omit-credentials-for-static-files branch April 23, 2024 21:50
@adamziel adamziel changed the title Play more nicely with server caches Service Worker: fetch credentialless to play more nicely with server caches (#1311) Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants