vite-plugin-terminal icon indicating copy to clipboard operation
vite-plugin-terminal copied to clipboard

Unable to use when using a backend integration due to cors errors

Open bitbytebit1 opened this issue 1 year ago • 2 comments

We are using Vite with PHP. This plugin doesn't currently work as it tries to post to the domain the site is hosted on instead of localhost. After poking around a bit I saw I can modify which URL is used by setting server.origin in vite.config.js. However the next work calls are blocked due to CORS errors, despite theserver.cors being set to true.

Any tips on how to resolve this?

Docs: https://vitejs.dev/guide/backend-integration.html https://github.com/andrefelipe/vite-php-setup

bitbytebit1 avatar Aug 09 '22 09:08 bitbytebit1

Are you on Firefox? Does it work on chrome or with the enhanced privacy stuff disabled for the domain? I agree permissive cors should be default, but it's hard to get that right with very annoying browser implementations, some of which don't like it when you set allow-origin to *.

Can you make a sandbox that demonstrates the problem? https://mobile.twitter.com/n_moore/status/1557726839665475591

FossPrime avatar Aug 17 '22 11:08 FossPrime

I don't know if it would directly solve this issue, but we should move away from sending HTTP requests to the server when logging and instead migrate to the new client-server communication available to plugins https://vitejs.dev/guide/api-plugin.html#client-server-communication

patak-dev avatar Aug 17 '22 11:08 patak-dev