0

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.

AeNiTo
  • 1
  • 2
  • You should never be making direct `OPTIONS` requests. Your browser does that automatically for pre-flighted cross-origin requests. And if you're using a proxy, there should not be a need for those in any case – Phil Oct 20 '22 at 04:02
  • My backend service has an endpoint that accepts OPTIONS request to determine which methods are allowed given a user's context. – AeNiTo Oct 20 '22 at 15:57

1 Answers1

0

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

cors: {
  preflightContinue: true
},
AeNiTo
  • 1
  • 2