workers-sdk
workers-sdk copied to clipboard
if-none-match failing to ever match
There's a quirk with either Pages proper or wrangler pages dev where any request with an if-none-match header gets completely messed up.
This issue is for an investigation into the behavior and subsequent fix.
https://github.com/remix-run/remix/blob/ca382b16223e2766fe333b22f177550d2f9070fc/packages/remix-cloudflare-pages/worker.ts#L53-L54
Seconding, this might be the reason:
"exceptions": [
{
"name": "TypeError",
"message": "ETag in HTTP header needs to be wrapped in quotes (W/\"0aswgdddom0h2pj2vefw3qvw3hvndj5f\").",
"timestamp": 1000000000000
}
],
Can someone add a reproducible example with the issue please?
I patched Remix to comment out the line where it deletes the if-none- matches header and weak ETags seems to work fine for me https://notionicons-cloudflare-pages.pages.dev
@GregBrimble I wonder if this could be related to your page containing an email address or http (as in, not https) url
Specifically from here: https://developers.cloudflare.com/cache/reference/etag-headers/
When using weak ETag headers, disable Email Obfuscation and Automatic HTTPS Rewrites to ensure Cloudflare does not remove the ETag headers set by your origin web server.
I have a hobby project where I saw this bug as well, however it was due to the main site's html being slightly different for every timestamp. Here's the non-repro: https://github.com/matthova/remix-cloudflare-pages-etag-repro IMO we should explore removing this line: https://github.com/remix-run/remix/blob/main/packages/remix-cloudflare-pages/worker.ts#L54
context.request.headers.delete("if-none-match");
and instead reference Cloudflare's advice related to modified etags, due to email obfuscation and https rewrites
Live site here https://remix-cloudflare-pages-etag-repro.pages.dev