10/12/2021, 7:14 PM
Hey 👋, I'm facing CORS issues using Ktor client for Kotlin JS. I'm know it's not an issue in ktor side, but I'm trying to find a solution.
Access to fetch at '<https://myserver/api/v1/csrf>' from origin '<http://localhost:8080>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I want to know if it's possible to use a reverse proxy in KotlinJs client. I tried to setup a proxy, in the engine setup, but it's not supported for JS. Basically, I need to do something like this (this is how I solve my issue using react) . Do you know how can do something similar using ktor? Or do you know some alternative? Thanks!
Maybe there is a better alternative


10/12/2021, 7:59 PM
If its only for development then you can also disable it in the browser with addons such as
I do not have experience with it myself but others I know of use something like this


10/12/2021, 8:21 PM
Thanks! I used this extension: But it didn't work in all endponts, I'm not sure why

Aleksei Tirman [JB]

10/13/2021, 8:29 AM
@mirland there is no built-in feature in the Ktor client to start a reverse proxy server. As one more alternative solution, you can configure Nginx as a reverse proxy where necessary CORS headers are sent with each response.
Or you can use Ktor server as a reverse proxy.


10/13/2021, 2:18 PM
Cool, I thought the same response, but I wanted just to confirm it! thanks!

Landry Norris

10/13/2021, 6:50 PM
I ran into a similar problem and it turned out that something (Google Cloud API Gateway) along the path from client to Ktor was blocking the options method.