Hi. I was trying to use ktor js client and failed ...
# javascript
g
Hi. I was trying to use ktor js client and failed to load anything because of CORS policy. How can it be handled ?
b
Cors needs to be handled on the server via cors headers
Here're the docs for ktor server https://ktor.io/docs/cors.html
g
but I'm not using server. I have only client and run project in Continuous Mode
Screenshot from 2022-04-24 16-58-05.png
b
Then there's nothing you can do except spinning up your own proxy server that would inject such headers
g
I'm wondering if it could be configured by passing any param to gradle task
b
This is just how cors work. Not a ktor specific issue.
You can bypass it locally by disabling cors in the browser (search how), but then your app will still break in production.
👍 2