Proxy Heroku
5 March, 2021 by
Proxy Heroku
Administrator

 

Applications on Heroku can use https, and it is free as it is under *.herokuapp.com certificate. However if you want to use your own custom domain, they would need a separate certificate and as such charge you $20 per month for essentially a load balancer in front of your application that encrypts the traffic. As a business that charge is negligible but as a hobby project it is not an option.

With this guide you can proxy this encrypted traffic and pay just ~$5 or less per month. And can share this across as many applications.

Open the previous main http server block in your Nginx configuration. And replace the static website parts with a proxypass.

sudo vi /etc/nginx/sites-available/example.comserver {
listen 443;
listen [::]:443;
servername www.example.com;

ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

location / {
proxy_pass https://example-live-01.herokuapp.com;
}
}sudo nginx -t && sudo service nginx reload;
curl https://www.example.com