Skip to content

Conversation

@kevinansfield
Copy link
Member

@kevinansfield kevinansfield commented Oct 24, 2019

no issue

When using certain proxy setups that result in host and x-forwarded-host being different, it became impossible to access Ghost because all routes showed generic 404 pages.

  • vhost module that we are using to separate front-end and admin urls does not use express' req.hostname so it does not pick up the x-forwarded-host url that express' 'trust proxy' config gives us
  • switched to the forked @tryghost/vhost-middleware package which has a one-line change to use req.hostname || req.host
  • added 'trust proxy' config to the admin express app and switched to using req.hostname in our redirect code to avoid infinite redirect loops

@kevinansfield kevinansfield force-pushed the fix-admin-access-with-reverse-proxies branch 4 times, most recently from 697c9dc to dcd38ed Compare October 28, 2019 11:00
no issue

When using certain proxy setups that result in `host` and `x-forwarded-host` being different, it became impossible to access Ghost because all routes showed generic 404 pages.

- `vhost` module that we are using to separate front-end and admin urls does not use express' `req.hostname` so it does not pick up the `x-forwarded-host` url that express' `'trust proxy'` config gives us
- switched to the forked `@tryghost/vhost-middleware` package which has a one-line change to use `req.hostname || req.host`
- added `'trust proxy'` config to the admin express app and switched to using `req.hostname` in our redirect code to avoid infinite redirect loops
@kevinansfield kevinansfield force-pushed the fix-admin-access-with-reverse-proxies branch from dcd38ed to b4f7094 Compare October 28, 2019 11:10
@kevinansfield kevinansfield merged commit 7284227 into TryGhost:master Oct 28, 2019
@kevinansfield kevinansfield deleted the fix-admin-access-with-reverse-proxies branch October 28, 2019 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant