Fail to pass request header `Origin`
See original GitHub issueIssue Report
Description
- Set header
Origin
in request, but no value found on server-side - Fuel version: 2.1.0
client
.post(path = ENDPOINT_OAUTH, parameters = listOf("grant_type" to "client_credentials"))
.authentication()
.basic(username = apiUsername(), password = apiPassword())
.header(Headers.CONTENT_TYPE, APPLICATION_FORM_URLENCODED)
.header(Headers.ACCEPT, APPLICATION_JSON)
.header("Origin", "http://xxx")
Expected behavior
http request header Origin
should be passed
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Reason: CORS header 'Origin' cannot be added - HTTP | MDN
The user agent was unable to add the required Origin header to the HTTP request. All CORS requests must have an Origin header....
Read more >Fixing "No 'Access-Control-Allow-Origin' Header Present"
This error occurs when a script on your website/web app attempts to make a request to a resource that isn't configured to accept...
Read more >Access Control Origin Header error using Axios - Stack Overflow
It works, because the server which sends the HTTP response included now a header stating that it is OK for cross-origin requests to...
Read more >CORS errors and how to solve them - Topcoder
Still facing a CORS error? ... Open a network tab in your console. ... In the response header look for the Access-Control-Allow-Origin header....
Read more >3 Ways to Fix the CORS Error — and How the Access-Control ...
Once the browser receives this header information back, it compares the frontend domain with the Access-Control-Allow-Origin value from the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is exactly what I expected.
This also means that fuel can not fix this. But you can follow the steps to allow restricted headers. Thanks @ryutoyasugi .
Thanks guys! Yeah, a quick fix is
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
or-Dsun.net.http.allowRestrictedHeaders=true