[ktor-client-js] Ktor's User-Agent breaks CORS policy in a browser
See original GitHub issuektor-client-core-js
1.3.0-rc
I’m using ktor client in a browser to network requests (obviously), but something recently changed and now ktor provides default user-agent in case the developer himself didn’t. That ruins in browser. User-Agent
header marks request as non-simple and browser performs cors-preflight request first, then rejects original request because User-Agent
not allowed header for that server (and particularly any other server).
The worst moment I can not override that behavior and delete User-Agent
header from request as this check performs on later stage inside of engine, so no any workarounds for me 😦.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
CORS - Ktor
By default, browsers don't send credential information (such as cookies or authentication information) with cross-origin requests. To allow ...
Read more >CORS pre-flight comes back with Access-Control-Allow-Origin ...
We have been noticing the same issue, where the server is sending the correct CORS headers, but the browser fails because it thinks...
Read more >3 Ways to Fix the CORS Error — and How the Access-Control ...
If the frontend domain does not match the value, the browser raises the red flag and blocks the API request with the CORS...
Read more >CORS errors - HTTP - MDN Web Docs - Mozilla
If the CORS configuration isn't setup correctly, the browser console will present an error like "Cross-Origin Request Blocked: The Same Origin ...
Read more >User-Agent header disallowed via 'Access-Control-Allow ...
Platform: API Browser: Firefox 87.0 URLs of any relevant ... to header 'Access-Control-Allow-Headers' from CORS preflight response).
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
Fix in
master
Derp, chromium just ignores ktor’s user-agent and sends their own in place. Seems ktor’s user-agent completely useless in a browser.