Comments (3)
This unit test ought to have caught this, but it did not because the various fetch implementations treat the Cookie field differently. Consider the following code snippet:
const h = new Headers()
h.append('cookie', 'foo')
h.append('cookie', 'bar')
console.log(h.get('cookie'))
The following implementations print 'foo, bar'
, with a comma: @remix-run/[email protected], Safari 17.5, Firefox 127.0.2, Chrome 126.0.6478.127
The following implementations print 'foo; bar
', with a semicolon: Node.js 20.14.0, [email protected]
The tests are probably run with either native fetch or undici, although the default Remix configuration (without the feature flag nativeFetch
set) probably uses @remix-run/web-fetch. So the test passes but the bug it's checking for appears in production.
I think that it is pretty clear that the browser along with @remix-run/web-fetch are doing what the the fetch
standard says: they are joining multiple occurrences of headers with a comma and a space; the standard does not specify any special treatment for the cookie
header. It is Node and undici that are violating the spec here --- although IMHO their behavior is a better design than the standard!
So I concur with @Courey: the fix here is to bring back the more portable method of reading the request cookie header from https://github.com/remix-run/remix/pull/1709/files#diff-e37d9e295b178aa51a4880acae4b8bc7f82759e6868583513a5fa52b16846408L102-R102. That won't make a difference for the (evidently not standards-conforming) Node.js native fetch or undici, but it will fix the matter for the legacy Remix fetch polyfill, and presumably any other JavaScript runtimes that do conform to the spec.
from remix.
🤖 Hello there,
We just published version 2.10.3-pre.0
which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
Thanks!
from remix.
🤖 Hello there,
We just published version 2.10.3
which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
Thanks!
from remix.
Related Issues (20)
- Browser addons injecting html cause hydration errors HOT 3
- Multiple remix dev servers in one express application
- Using `createCookie` in a route module causes `fetcher.Form` to do a document reload on submission HOT 2
- Loader request not cancelled when streaming promises Single Fetch HOT 3
- Single Fetch throwing response does not work HOT 9
- Single Fetch's useRouteLoaderData return type is missing undefined HOT 4
- Vite dependency optimization is causing errors in development HOT 1
- Fog of War: Loader data becomes undefined on navigation HOT 4
- Error thrown while listing Headers with single-fetch response stub in production build HOT 1
- Link tag navigating to route reloads page & no network fetch calls HOT 1
- Singlefetch `Error: Unable to decode turbo-stream response from URL: <URL>` HOT 7
- No route matched Vitest + Vite HOT 1
- 404 Page Causes Infinite Reload After Using `npx create-remix@latest` HOT 9
- unstable_data response headers not set HOT 4
- useLoaderData types broken if unstable_data is conditionally used HOT 1
- `cloudflareDevProxyVitePlugin` returns error type under `NodeNext` module resolution HOT 3
- When using the onerror event on an <img> element, the event does not trigger again after a page reload HOT 2
- BUG: useId generates duplicate IDs on initial render (ssr) HOT 1
- dev server unexpectedly loads CSS when using `?inline` imports
- Cookie Session Storage value received from root loader sometimes stale HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remix.