Skip to content

Commit

Permalink
Merge pull request #13 from Miaplaza/allow_reverse_proxy
Browse files Browse the repository at this point in the history
allow usage of express' 'trust proxy' to use reverse proxy for parse …
  • Loading branch information
yongjhih committed Mar 8, 2016
2 parents ae8b76d + 7b8f88f commit 34d0dfb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ parse-server:
ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # true
APP_NAME: $APP_NAME
PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL
# ...
TRUST_PROXY: $TRUST_PROXY # false
# ...
```

Remote parse-cloud-code image:
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ parse-server:
ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # true
APP_NAME: $APP_NAME
PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL
links:
TRUST_PROXY: $TRUST_PROXY
links:
- mongo
volumes_from:
- parse-cloud-code
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ var api = new ParseServer({

var app = express();

if(process.env.TRUST_PROXY == 1) {
console.log("trusting proxy");
app.enable('trust proxy');
}

// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"nodemon": "^1.8.1",
"docker-links": "^1.0.2",
"express": "~4.2.x",
"express": "~4.13.x",
"kerberos": "~0.0.x",
"parse": "~1.6.12",
"parse-server": "~2.1.4"
Expand Down

0 comments on commit 34d0dfb

Please sign in to comment.