Comments (3)
This has been addressed in the upcoming cors
rewrite #226. :)
Thanks for the investigation and discussion - it was hugely instrumental to make sure these edge cases were covered!
That said, it's a bit of a good-news/bad-news situation.
The Good
- This case is covered, including test support
- We're supporting more CORS options (mirroring the options of express.js) and syntaxes
- We've managed to shed 120 bytes from the CORS function in the process (~600 --> ~480) :)
The Bad
- It's part of remedying a fundamental flaw in the existing implementation, which is a breaking change, so we started over
- This will be part of the v5.x release, that'll come with a couple powerful additions (supercharged routers) and a small housekeeping breaking change to save bytes by dropping compatibility support.
Stay tuned!
from itty-router.
I had the same issue. After checking the createCors
implementation I found the lines that may be causing this issue:
// Return new response with CORS headers.
return new Response(body, {
status,
headers: {
...Object.fromEntries(headers),
...rHeaders,
...allowOrigin,
'content-type': headers.get('content-type'),
},
})
To add multiple headers with the same name I had to use the headers.append
method, so I believe that those lines should use this function instead. Later today I might create a PR to fix this, but I cannot do that atm
from itty-router.
This has been fully addressed in the v5 release! Thanks again all!
from itty-router.
Related Issues (20)
- How to Use Itty Router with Next.js? HOT 1
- Typescript router "Additional types" are ignored HOT 10
- Setting up cron trigger? HOT 2
- cors functions are stateful HOT 8
- Nested routers ergonomics HOT 8
- Does `json()` support `headers` in options? HOT 4
- `withContent` returns a 500 when no body is sent HOT 1
- CORS issue, no preflight request shown HOT 6
- PROPOSAL: CORS HOT 4
- multiple set-cookie headers are removed by corsify
- Exception thrown by withContent HOT 5
- Corsify override http error code. HOT 3
- typescript compilation error when using itty-router 5.0.5 HOT 3
- Uncaught TypeError: (src_default.middleware ?? []) is not iterable HOT 4
- Issue with CORS when response is cached HOT 2
- TS compilation error when using itty-router 5.0.17 HOT 11
- withContent middleware fails on BunJS HOT 1
- Feedbdack on deprecation of router.handle HOT 2
- Requests in v5 are hanging, examples not working HOT 7
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 itty-router.