Origin in request, but no value found on server-sideclient
.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")
http request header Origin should be passed
Are you certain it's not _sent_ and not just (lack of) CORS settings on the server?
Hi @SleeplessByte , thanks for your reply!
I have tested it:
curl, Postman or invoking from other services (like nodejs).origin can not be passed into servercom.github.kittinunf.fuel.toolbox.HttpClient (debuging screenshot will be attached)
Thank you very much! That is very helpful :)
cool thanks
This article may be helpful
https://stackoverflow.com/questions/8335501/does-httpurlconnection-censor-some-headers-notably-origin
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
Is there anything from us (Fuel side) to help users? Should we create an FAQs or something?
Most helpful comment
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 .