Description
Describe the bug
We have a missing cookie rewrite which doesn't work. After some debugging, it seems like the issue is in cookies being wrongly parsed.
Cookies passed to the matcher:
cookies { _ga: 'xxx; codeVariant' }
Cookies from the headers:
cookie: 'xxx; codeVariant=TS; codeStyling=none; _ga_XJ83JQEK7J=xxx; crisp-client%2Fsession%2Fd4cd5bac-6848-4f4d-9a7f-082f5b324b79=xxx; _octo=xxx; sidebar:state=false; cpu_bucket=xxx; preferred_color_mode=xxx; tz=xxx; test=xxx'
This implementation is wrong:
Cookies are semicolon-separated, not comma-separated.
Steps to reproduce
-
Add a rewrite to next.config:
async rewrites() { return { beforeFiles: [ { source: "/test", destination: "https://github.com", missing: [ { type: "cookie", key: "test", }, ], }, ], }; },
-
Add a cookie
test
with any value. -
The rewrite will always pass.
Expected behavior
Rewrite should
@opennextjs/cloudflare version
1.0.4
Wrangler version
4.17.0
next info output
N/A
Additional context
No response