You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added support for trusting proxies w/ HTTPS (#535)
* Added https check for Heroku
* Made Heroku HTTPS check more robust - added client switch for trusting proxies, and used app.enable('trust proxy') to let Express parse the headers
* Added support for setting trust proxy when using as middleware
* Updated README
* README edits
* Pull request feedback to combine trustProxy into dashboard config object and de-emphasize allowInsecureHTTP in favor of trustProxy
Copy file name to clipboardExpand all lines: Parse-Dashboard/index.js
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,13 +24,20 @@ program.option('--mountPath [mountPath]', 'the mount path to run parse-dashboard
24
24
program.option('--allowInsecureHTTP [allowInsecureHTTP]','set this flag when you are running the dashboard behind an HTTPS load balancer or proxy with early SSL termination.');
25
25
program.option('--sslKey [sslKey]','the path to the SSL private key.');
26
26
program.option('--sslCert [sslCert]','the path to the SSL certificate.');
27
+
program.option('--trustProxy [trustProxy]','set this flag when you are behind a front-facing proxy, such as when hosting on Heroku. Uses X-Forwarded-* headers to determine the client\'s connection and IP address.');
@@ -213,7 +213,24 @@ Make sure the server URLs for your apps can be accessed by your browser. If you
213
213
## Security Considerations
214
214
In order to securely deploy the dashboard without leaking your apps master key, you will need to use HTTPS and Basic Authentication.
215
215
216
-
The deployed dashboard detects if you are using a secure connection. If you are deploying the dashboard behind a load balancer or proxy that does early SSL termination, then the app won't be able to detect that the connection is secure. In this case, you can start the dashboard with the `--allowInsecureHTTP=1` option. You will then be responsible for ensureing that your proxy or load balancer only allows HTTPS.
216
+
The deployed dashboard detects if you are using a secure connection. If you are deploying the dashboard behind a load balancer or front-facing proxy, then the app won't be able to detect that the connection is secure. In this case, you can start the dashboard with the `--trustProxy=1` option (or set the PARSE_DASHBOARD_TRUST_PROXY config var to 1) to rely on the X-Forwarded-* headers for the client's connection security. This is useful for hosting on services like Heroku, where you can trust the provided proxy headers to correctly determine whether you're using HTTP or HTTPS. You can also turn on this setting when using the dashboard as [express](https://github.com/expressjs/express) middleware:
217
+
218
+
```
219
+
var trustProxy = true;
220
+
var dashboard = new ParseDashboard({
221
+
"apps": [
222
+
{
223
+
"serverURL": "http://localhost:1337/parse",
224
+
"appId": "myAppId",
225
+
"masterKey": "myMasterKey",
226
+
"appName": "MyApp"
227
+
}
228
+
],
229
+
"trustProxy": 1
230
+
});
231
+
```
232
+
233
+
217
234
218
235
### Configuring Basic Authentication
219
236
You can configure your dashboard for Basic Authentication by adding usernames and passwords your `parse-dashboard-config.json` configuration file:
0 commit comments