7

Having Hatchbox Redirect All http Sites it Manages to https

 1 year ago
source link: https://fuzzyblog.io/blog/hatchbox/2020/03/28/having-hatchbox-redirect-all-http-sites-it-manages-to-https.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Having Hatchbox Redirect All http Sites it Manages to https

Mar 28, 2020

When you are using hatchbox and SSL in cluster mode you end up with:

  • a load balanced cluster
  • that uses nginx as the load balancer
  • and nginx on each web node

This makes it hard to understand where the http to https redirect goes. The answer is that you need to but this on the load balancer and here's a code snippet:

server_name _;
return 301 https://$host$request_uri;

This gets set as follows:

  1. Go into Hatchbox.io
  2. Go into your app.
  3. Go to Advanced.
  4. Select Nginx Configuration from the drop down menu
  5. Select the Load Balancer tab.

Add these changes below the listen [::]:80; directive and then do a deploy.

For reference, you can see linuxize.


Posted In: #hatchbox #https


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK