-
Notifications
You must be signed in to change notification settings - Fork 7
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
Redirect protocol and host #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Straightforward.
package.json
Outdated
@@ -23,7 +23,7 @@ | |||
"commander": "1.1.x", | |||
"continuation-local-storage": "~3.1.1", | |||
"express": "3.1.x", | |||
"express-expose": "SparkartGroupInc/express-expose#escape-script-ending-tag", | |||
"express-expose": "sparkartgroupinc/express-expose#escape-script-ending-tag", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well use the new org name, sparkartgroup
@@ -116,6 +116,7 @@ var SolidusServer = function( options ){ | |||
router.engine( DEFAULT_VIEW_EXTENSION, handlebars.engine ); | |||
router.set( 'view engine', DEFAULT_VIEW_EXTENSION ); | |||
router.set( 'views', paths.views ); | |||
router.set( 'trust proxy', true ); // Use the X-Forwarded-* headers: https://expressjs.com/en/guide/behind-proxies.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required by Fastly, or any other CDN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, the HTTPS protocol doesn't seem to be detected by Solidus on Heroku, so HTTPS requests end up in redirect loops.
Adds ability to redirect from and to a specific protocol and/or host. It is now possible to use objects for the
from
andto
properties inredirects.js
.If a
from
object is used (instead of the usual string or regular expression), the following properties are available:protocol
- If specified, the request's protocol must match for the whole redirect to match (http
orhttps
).host
- If specified, the request's host must match for the whole redirect to match (for examplesite.com
).path
- The path to match, this is the same as the originalfrom
. Defaults to*
, to match all paths.If a
to
object is used (instead of the usual string or function), the following properties are available:protocol
- If specified, will override the request's protocol.host
- If specified, will override the request's host.url
- The url to redirect to, this is the same as the originalto
. Defaults to the request's url.Example to automatically redirect to HTTPS and from the root domain to the
www
subdomain: