Skip to content

Fixes #88 - Allow specifying X-FRAME-OPTIONS with an environment vari… #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,23 @@ Password: changeme
```

Immediately after logging in with this default user you will be asked to modify your details and change your password.


### Advanced Options

#### X-FRAME-OPTIONS Header

You can configure the [`X-FRAME-OPTIONS`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) header
value by specifying it as a Docker environment variable. The default if not specified is `deny`.

```yml
...
environment:
X_FRAME_OPTIONS: "sameorigin"
...
```

```
... -e "X_FRAME_OPTIONS=sameorigin" ...
```

8 changes: 7 additions & 1 deletion src/backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ app.use(require('./lib/express/cors'));

// General security/cache related headers + server header
app.use(function (req, res, next) {
let x_frame_options = 'DENY';

if (typeof process.env.X_FRAME_OPTIONS !== 'undefined' && process.env.X_FRAME_OPTIONS) {
x_frame_options = process.env.X_FRAME_OPTIONS;
}

res.set({
'Strict-Transport-Security': 'includeSubDomains; max-age=631138519; preload',
'X-XSS-Protection': '0',
'X-Content-Type-Options': 'nosniff',
'X-Frame-Options': 'DENY',
'X-Frame-Options': x_frame_options,
'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate',
Pragma: 'no-cache',
Expires: 0
Expand Down
2 changes: 0 additions & 2 deletions src/backend/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env node

'use strict';

const logger = require('./logger').global;

function appStart () {
Expand Down