Replies: 1 comment
-
|
Solution: express nodejs, add code before routing: app.use((req, res, next) => {
res.set({
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
"Access-Control-Allow-Methods": "GET, POST, PATCH, DELETE, OPTIONS",
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src 'self' https://cdn.jsdelivr.net https://unpkg.com",
"X-Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src 'self' https://cdn.jsdelivr.net https://unpkg.com",
"X-WebKit-CSP": "default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src 'self' https://cdn.jsdelivr.net https://unpkg.com"
});
next();
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use Vite+React+Nodejs. During tests (npm run dev) everything works fine.

But after building the frontend project (npm run build) an error is displayed in the browser console:
How can this be solved? Why does this problem arise?
Beta Was this translation helpful? Give feedback.
All reactions