Comments (3)
As this header is added by the browser, as opposed to JS, I would assume the browser won't "ask" for permission before to send it and thus it is not necessary to whitelist it in CORS. Do you have an actual example where not specifically whitelisting this header is an issue?
from cors.
My mistake, I meant to say it is not sent by browsers and is instead set in application JS. So when that application JS sets the header, the browser will add Access-Control-Request-Headers: x-requested-with
to the headers of the OPTIONS
preflight request.
This header is commonly sent along by default in some frameworks, so yes it's always possible to turn it off. However since I do believe it's fairly common, it might make sense to add it to the defaults here.
It's also totally fine to say "X-Requested-With isn't in the CORS spec, so it's not going to be supported by default".
from cors.
Ok, feel free to send a PR. I don't think it's harmful to add it to the default.
from cors.
Related Issues (20)
- Will support fasthttp router?
- security issue: should not allow rejected requests to go forward HOT 4
- Unexpected response when requesting with multiple comma separated origins and wildcard AllowedOrigins HOT 6
- gocover.io has shut down HOT 1
- gin wrapper default status HOT 1
- Listing Origin as an allowed request header is unnecessary HOT 4
- No way to disable caching of preflight responses HOT 1
- Access-Control-Expose-Headers should be sent in preflight response HOT 2
- AllowOriginRequestFunc considered harmful (may lead to Web cache poisoning) HOT 2
- Allowing methods that are not uppercase should be possible but isn't HOT 5
- Unexpected `Access-Control-Expose-Headers` header behavior HOT 2
- [Feature Request] AllowCredentialsFunc: boolean, HOT 2
- Middleware benchmarks are still skewed (follow-up to #156)
- AllowedOrigins doesn't block unlisted origins HOT 2
- .
- Some malicious/spoofed preflight requests cause prohibitive load HOT 3
- cors not adding multiple Access-Control-Allow-Origin entries HOT 2
- failing local test since v1.11.0 HOT 3
- Case-sensitive look up on allowed headers map HOT 4
- Arbitrary origin allowed in CORS header HOT 1
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 cors.