ETag should consider CORS headers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #6908 by @opnsrcntrbtr — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- express, javascript, node.js
Research direction
No files or tests are named. Start by reproducing the described cross-origin request sequence with the Express server, CDN caching, ETag validation, and differing access-control-allow-origin values; the work is done when responses with different CORS origins no longer incorrectly reuse the same ETag and the relevant behavior is covered by tests.
Written by the indexing model from the issue text.
Description
TL;DR: I want the ETag to change when the access-control-allow-origin header is different but the response body is the same.
We are facing an issue right now with a couple moving parts working poorly together.
It's a bit difficult to explain but I'll try my best.
- When sending a request from Chrome to a spec-compliant CDN, it will initially hit the express server.
- The express server responds with the resource, CORS & Vary headers, and an ETag derived from the response body.
- The CDN will cache the response headers and body.
- Chrome will also cache the response headers and body.
- When Chrome requests the resource from a different origin, it may take the ETag cached for a different Origin and send it to the CDN (this is spec-compliant).
- This may then lead the CDN to respond with a 304 Not Modified, as the CDN may have a resource for the origin and ETag in the cache.
- Responding with 304 will only return partial headers (explicitly excluding CORS headers; Some spec says it should NOT return CORS headers here).
- This then leads Chrome to take the response from the cache and think that the Origins mismatch → throwing a CORS error.
This is kind of messed up, as all parties do comply with the specs, though when put together, the specs don't work nicely together.
The best way to fix this would be for the server to generate a different ETag when the access-control-allow-origin header differs.
- Dominant language
- JavaScript
- Stars
- 69.7k
- Forks
- 25.6k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from expressjs/express
-
Outdated res.send() syntax in lib/response.js documentation exampleMay be free again A pull request for this issue was closed without being merged. Opendocs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
expressjs/express#7588 · 1 comment ·
Maintainers usually reply within 1 day
-
4.x deps module:body-parser
Difficulty 1/5 Under an hour Newbie friendliness 75/100
expressjs/express#7564 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Update to mocha 12.xPossibly taken @ganeshghutukade-04 claimed this 26 days ago. Opendeps
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
expressjs/express#7547 · 6 comments ·
Maintainers usually reply within 1 day
-
req.subdomains splits an IPv6 host that contains dotsPossibly taken @johnnyhuirilef claimed this 30 days ago. Open4.x 5.x bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
expressjs/express#7532 · 2 comments ·
Maintainers usually reply within 1 day
-
Readme: project name 'express.js' is not capitalizedMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
All issues in expressjs/express
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
anothaDev/luci-theme-vantage#143 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
kingcharleslzy-ai/dsh-purge#282 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
a-corriger bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
christian-raj/S-Aloha#340 ·
-
area:image documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day