[next] Added trust proxy configuration (#2471)

* feat: added trust proxy configuration

* chore: version bump
This commit is contained in:
Wyatt Johnson
2019-08-13 15:41:50 -04:00
committed by Kim Gardner
parent abb793b16a
commit e76fddd13c
5 changed files with 17 additions and 5 deletions
+1
View File
@@ -388,6 +388,7 @@ the variables in a `.env` file in the root of the project in a simple
- `WEBSOCKET_KEEP_ALIVE_TIMEOUT` - A duration in a parsable format (e.g. `30 seconds` - `WEBSOCKET_KEEP_ALIVE_TIMEOUT` - A duration in a parsable format (e.g. `30 seconds`
, `1 minute`) that should be used to send keep alive messages through the , `1 minute`) that should be used to send keep alive messages through the
websocket to keep the socket alive (Default `30 seconds`) websocket to keep the socket alive (Default `30 seconds`)
- `TRUST_PROXY` - When provided, it configures the "trust proxy" settings for Express (See https://expressjs.com/en/guide/behind-proxies.html)
## License ## License
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@coralproject/talk", "name": "@coralproject/talk",
"version": "5.0.0-beta.5", "version": "5.0.0-beta.7",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@coralproject/talk", "name": "@coralproject/talk",
"version": "5.0.0-beta.6", "version": "5.0.0-beta.7",
"author": "The Coral Project", "author": "The Coral Project",
"homepage": "https://coralproject.net/", "homepage": "https://coralproject.net/",
"sideEffects": [ "sideEffects": [
+6 -3
View File
@@ -104,9 +104,12 @@ export const listenAndServe = (
function configureApplication(options: AppOptions) { function configureApplication(options: AppOptions) {
const { parent } = options; const { parent } = options;
// Trust the first proxy in front of us, this will enable us to trust the fact // Trust the proxy in front of us, this will enable us to trust the fact that
// that SSL was terminated correctly. // SSL was terminated correctly.
parent.set("trust proxy", 1); const trust = options.config.get("trust_proxy");
if (trust) {
parent.set("trust proxy", trust);
}
// Setup the view config. // Setup the view config.
setupViews(options); setupViews(options);
+8
View File
@@ -59,6 +59,14 @@ const config = convict({
default: "en-US", default: "en-US",
env: "LOCALE", env: "LOCALE",
}, },
trust_proxy: {
doc:
'When provided, it configures the "trust proxy" settings for Express (See https://expressjs.com/en/guide/behind-proxies.html)',
format: String,
default: "",
env: "TRUST_PROXY",
arg: "trustProxy",
},
enable_graphiql: { enable_graphiql: {
doc: "When true, this will enable the GraphiQL interface at /graphiql", doc: "When true, this will enable the GraphiQL interface at /graphiql",
format: Boolean, format: Boolean,