question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fail to pass request header `Origin`

See original GitHub issue

Issue 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:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
SleeplessBytecommented, Jan 12, 2020

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 .

2reactions
leo7commented, Jan 17, 2020

Thanks guys! Yeah, a quick fix is System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); or -Dsun.net.http.allowRestrictedHeaders=true

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found