Skip to content
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

Proposal: auto redirect to https #187

Closed
edwardhorsford opened this issue May 4, 2016 · 4 comments
Closed

Proposal: auto redirect to https #187

edwardhorsford opened this issue May 4, 2016 · 4 comments

Comments

@edwardhorsford
Copy link
Contributor

edwardhorsford commented May 4, 2016

I've just noticed that https urls work on herokuapp.com. This is ace.

Proposal: if running on heroku, autoredirect app from http to https.

Any downsides to doing this?

Edit: this is the code I use on my personal site to redirect:

function forceSSL (req, res, next) {
    if (req.headers['x-forwarded-proto'] !== 'https') {
        return res.redirect(301, ['https://', req.get('Host'), req.url].join(''));
    }
    return next();
};
@joelanman
Copy link
Contributor

sounds good to me - dont think you need to return next() - just call it?

@edwardhorsford
Copy link
Contributor Author

I think I've got it as middleware high up so all my requests go through it.

@joelanman
Copy link
Contributor

@edwardhorsford
Copy link
Contributor Author

fixed by #188

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

No branches or pull requests

2 participants