Skip to content

Commit

Permalink
Merge pull request #37 from icapps/bugfix/#33-safari-session-cookies
Browse files Browse the repository at this point in the history
#33 Safari fix: include credentials header
  • Loading branch information
knor-el-snor committed Mar 8, 2019
2 parents d4afda9 + 0d48c96 commit 470f955
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const redisStore = require('express-brute-redis');
export function setBasicSecurity(app: Application, route: string, options: SecurityOptions = {}): void {
app.use(route, helmet(Object.assign({}, defaults.helmetOptions, options.helmet)));
app.use(route, cors(Object.assign({}, defaults.corsOptions, options.cors)));
// SAFARI BUGFIX: include credentials
app.use((_req, res, next) => { res.set('credentials', 'include'); next(); });
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/express.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe('Express', () => {
expect(headers).toHaveProperty('x-download-options');
expect(headers).toHaveProperty('strict-transport-security');

// Safari bugfix for sessions
expect(headers).toHaveProperty('credentials', 'include');

// cors
expect(headers).toHaveProperty('access-control-allow-origin');
});
Expand Down

0 comments on commit 470f955

Please sign in to comment.