Scott's Recipes Logo

Having Hatchbox Redirect All http Sites it Manages to https

Pizza courtesy of Pizza for Ukraine!

Donate Now to Pizza for Ukraine

 

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

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.