diff --git a/backend/utils/app.js b/backend/utils/app.js index a5973ff8..f6f32aea 100644 --- a/backend/utils/app.js +++ b/backend/utils/app.js @@ -41,7 +41,10 @@ export class ExpressApplication { this.app.use(this.common.baseHref + '/api/ecl', eclRoutes); this.app.use(this.common.baseHref, express.static(join(this.directoryName, '../..', 'frontend'))); this.app.use((req, res, next) => { + // For Angular App res.cookie('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : ''); + // For JQuery Browser Plugin + res.setHeader('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : ''); res.sendFile(join(this.directoryName, '../..', 'frontend', 'index.html')); }); this.app.use((err, req, res, next) => this.handleApplicationErrors(err, res)); diff --git a/server/utils/app.ts b/server/utils/app.ts index f7c42e26..d264885d 100644 --- a/server/utils/app.ts +++ b/server/utils/app.ts @@ -63,7 +63,10 @@ export class ExpressApplication { this.app.use(this.common.baseHref + '/api/ecl', eclRoutes); this.app.use(this.common.baseHref, express.static(join(this.directoryName, '../..', 'frontend'))); this.app.use((req: any, res, next) => { + // For Angular App res.cookie('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : ''); + // For JQuery Browser Plugin + res.setHeader('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : ''); res.sendFile(join(this.directoryName, '../..', 'frontend', 'index.html')); }); this.app.use((err, req, res, next) => this.handleApplicationErrors(err, res));