Search code examples
typescriptaxiosvuejs3vitenode-http-proxy

Is there a way to get Vite.js to use axios.options?


I am in the process of moving everything from Vue CLI to Vite. Right now, I have everything that was in vue.config.js to be in vite.config.ts of the new project. Every axios call that was proxy works except axios.options.

I've checked in my Browser > Inspect > Network and it shows that it is a status 204 for this options call. My backend service did not detect any options call.

Does Vite.js proxy not support options calls? If so, is there a workaround for this? I think I have to change something in vite.config.ts > server > proxy > configure but I am unsure.

EDIT: My backend endpoint that accepts the OPTIONS call determines which HTTPs methods is allowed. There are methods I allow for certain context.


Solution

  • Turned off preflight for cors in vite.config.ts and it worked.

    cors: {
      preflightContinue: true
    },