heroku: set SSL certificates on Free Plan?

前端 未结 8 802
遇见更好的自我
遇见更好的自我 2020-12-24 13:20

I would like to set some SSL certificates for one app I have on heroku (a simple application based on nodeJS + Vue).

I know if I upgrade to the Hobby Plan (7$ for mo

相关标签:
8条回答
  • 2020-12-24 14:14

    Here I have a better approach to deal with this. As Heroku Doesn't provide SSL for Free Plan. But You can use Cloudflare which gives free SSL. You can Use Cloudflare As Bridge For SSL.

    Requirement: 1. Cloudflare Account 2. Your Application should not have inbuild SSL redirection (like redirect-ssl) Otherwise, This will result in Too Many Redirect Error

    Step 1: Point Your domain to CloudFlare. You basically open an account an enter your domain when prompted. You may be given instructions to change your domain name servers.

    Step 2: Add Cname Record of Heroku Server in DNS of Cloudflare. Instructions are here Here You will get Some SSL Security Issue.

    Step 3: Now Change Your SSL/TLS encryption mode to Flexible (Not Full). *Important

    Now Understand the Working:-

    Client(Browser) Make Request to https://example.com First, the request reaches the Cloudflare with SSL. (User see encrypted connection to the server.)

    Then Cloudflare makes request to Heroku Server(Origin) with Non-SSL (Non-Https and Unencrypted).

    Then Heroku Server (Origin) returns the Response with Non-SSL to Cloudflare.

    At the end Cloudflare forward the request to Client (Browser.)


    I have tested this method and working on https://www.foneman.in

    0 讨论(0)
  • 2020-12-24 14:18

    One way around this could be setting up a proxy server on a host you can set SSL certificates on and then simply forward requests to the free herokudns domain using encryption as well.

    You'd have to have a separate server with something like nginx or httpd running.. I am not sure of a free service to host the proxy, but usually when you sign up for a domain you may get a hosting addon with it, or perhaps people already have acess to an encrypted host and just want to also use Heroku for their node applications.

    Setting up a httpd proxy would look somewhat like this (from https://serverfault.com/questions/84821/apache-proxypass-with-ssl):

    <VirtualHost 1.2.3.4:80>
    ServerName customdomain.com
    SSLProxyEngine On
    SSLProxyCheckPeerCN on
    SSLProxyCheckPeerExpire on
    ProxyPass / https://heroku-app-name.herokuapp.com
    ProxyPassReverse / https://heroku-app-name.herokuapp.com
    </VirtualHost>
    

    This way you have full encryption all the way :)

    0 讨论(0)
提交回复
热议问题