question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

option to force https on heroku

See original GitHub issue

I have verdaccio running in a container on heroku running in http but can be accessed through SSL using their reverse proxy. Their method of forcing redirect to https is like this:

https://devcenter.heroku.com/articles/http-routing#heroku-headers

X-Forwarded-Proto: the originating protocol of the HTTP request (example: https)

method for redirecting with node/express – see https://jaketrent.com/post/https-redirect-node-heroku/

  app.use((req, res, next) => {
    if (req.header('x-forwarded-proto') !== 'https')
      res.redirect(`https://${req.header('host')}${req.url}`)
    else
      next()
  })

Describe the solution you’d like

Might be great to have some way to redirect non-http to https. Not sure what would be most flexible, a configuration option where I can say “when” to redirect, something like:

redirect:
  when:
    header: X-Forward-Proto
  is:
    http
  to:
     https

or perhaps some javascript if statement that can be evaled to keep it open ended as possible

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
honzahommercommented, May 11, 2019
1reaction
ilovettcommented, May 13, 2019

Thanks @honzahommer !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can Heroku force an application to use SSL/TLS?
Can Heroku force an application to use SSL/TLS? Issue. You have configured an SSL certificate and now you want your application to use...
Read more >
How To Force HTTPS (SSL/TLS) on Heroku - Expedited Security
1. Security · Plain http connections being marked as insecure. · Encrypted https connections being marked as secure.
Read more >
Force my heroku app to use SSL (https) - Stack Overflow
As of July 2019, Heroku supports HTTPS redirects to OTHER DOMAINS OR SUBDOMAINS (a redirect cannot point to itself) ...
Read more >
Redirect HTTP to HTTPS (for Heroku) #2597 - GitHub
use nginx, convert http to https, and of course, you can configure nginx to serve SSL as well. Method II: you can build...
Read more >
Installing an SSL certificate on Heroku SSL - Hosting
Heroku SSL is a free feature that allows for the managing of SSL/TLS encryption for custom domains and relies on the Server Name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found