mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
⚡ Do not add cors headers in production mode
This commit is contained in:
@@ -204,6 +204,7 @@ class App {
|
|||||||
//support application/x-www-form-urlencoded post data
|
//support application/x-www-form-urlencoded post data
|
||||||
this.app.use(bodyParser.urlencoded({ extended: false }));
|
this.app.use(bodyParser.urlencoded({ extended: false }));
|
||||||
|
|
||||||
|
if (process.env['NODE_ENV'] !== 'production') {
|
||||||
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
|
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||||
// Allow access also from frontend when developing
|
// Allow access also from frontend when developing
|
||||||
res.header('Access-Control-Allow-Origin', 'http://localhost:8080');
|
res.header('Access-Control-Allow-Origin', 'http://localhost:8080');
|
||||||
@@ -211,6 +212,7 @@ class App {
|
|||||||
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, sessionid');
|
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, sessionid');
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
|
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user