Apr 6, 2024
0
Level 1
Laravel Sail Vite with vscode.dev doesn't work - CORS Error
I tried to develop from remote (own server) vs code runs in browser, connected to my project, Laravel Sail is up too. But i can not use port Forwarding with vite, my website is showing up but CSS etc. not. When Port 8080:80 is forwarded. I always get CORS Error:
Access to script at '***.ms:5173/@vite/client' from origin '***.devtunnels.ms' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
client:1
Failed to load resource: net::ERR_FAILED
My vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
// input: ['resources/css/app.css', 'resources/js/app.js'],
input: ['resources/scss/app.scss', 'resources/js/app.js'],
refresh: true,
}),
],
server: {
https: true,
host: true,
port: 5173,
hmr: {
// host: '***eu.wdevtunnels.ms',
host: '***euw.devtunnels.ms'
// port: 5173,
},
}
});
Please or to participate in this conversation.