Repository navigation
fix(seo): warn when Cloudflare strips the ETag from a page - #637
Merged
Merged
Conversation
Every deploy since #636 failed the edge cache check with `no-etag`. The Worker sends the ETag, but Cloudflare removes it from an HTML 200 while a zone feature that rewrites HTML is on, such as Email Obfuscation or Automatic HTTPS Rewrites. A 304 has no body, so it keeps the ETag. The check now asks for a 304 with `If-None-Match: *` when the page has no ETag, reads the ETag there, and runs the 304 and stored-page checks with it. A stripped ETag becomes a warning and a GitHub annotation. The deploy still fails when no response carries an ETag, or when a 304 replaces the stored page.
Contributor
🤖 MERGED
GitHub merged this pull request. No material findings were recorded. The pull request closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
❓ Type of change
📚 Description
Every deploy since #636 fails
pnpm production:edge-cachewithno-etag. The Worker does send the ETag, but Cloudflare removes it from an HTML 200 while a zone feature that rewrites HTML is on. On skilld.dev, Email Obfuscation, Automatic HTTPS Rewrites and Replace insecure JavaScript libraries are all on. Cloudflare's ETag reference names them as features that remove ETags. A 304 has no body, so it keeps the ETag:When a page arrives without an ETag, the check now asks for a 304 with
If-None-Match: *and reads the ETag there. It runs the 304 and stored-page checks with that ETag. A stripped ETag becomes a warning in the result and a GitHub annotation. The deploy still fails when no response carries an ETag, or when a 304 replaces a stored page.Crawlers still never see the ETag on a 200, so they cannot send it back. That needs a zone change: turn those three features off for skilld.dev, or add a Configuration Rule that turns them off for its HTML. This pull request changes no zone setting.