reactjs – React Js in Laravel 11 in the ngnix server
I created React js and run the code in the Laravel Interia When I call link, it shows error like “Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource” in the vite.config.js file code is
export default defineConfig({ server: {
https: {
key: fs.readFileSync('./localhost-key.pem'), // Path to the private key
cert: fs.readFileSync('./localhost.pem'),
},
host: 'mangalmalldev.in', // Use 'localhost' or '0.0.0.0' for local development
port: 5173,
cors: {
origin: '*', // Allow all origins during development
methods: 'GET,HEAD,PUT,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
},
strictPort: true, // Ensure the server fails if the port is already taken
}, ..............
I am facing that issue when i directly called that page madev.in:5173/@vite/client
Warning: Potential Security Risk Ahead, The laravel code, the react is not loading, in the inspect element console, it shows error like
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource.
Read more here: Source link
