How to Add a Wildcard SSL Certificate on a Heroku Rails App
In general, installing the SSL Certificate is a bit challenging. Now if you include Heroku on this, as well as the need for a wildcard SSL Certificate, the process can become even more complicated. But don’t worry for the process is actually easy, if you have a guide to follow. So to help you on this, refer below for the steps on how to add a wildcard SSL Certificate on the Heroku Rails app. By following these steps, you can get the process done with no complication involved.
Buy a Wildcard SSL Certificate
First of all, the first thing that you must do is to purchase a wildcard SSL Certificate. You can go to GoDaddy to purchase your wildcard SSL Certificate, although pretty much, any SSL will work, but GoDaddy is highly reliable when it comes to SSL Certificates. They are also recommended by DNSimple along with Comodo.
Add the SSL Endpoint Add-on
The next step is to add the SSL Endpoint Add-on into your app and you can do this through Heroku. This is an additional $20 per month to enable such service and that is really how things work here in Heroku. By this stage, you should already have your Wildcard SSL Certificate installed with Heroku. You will know if you have successfully installed it by simply dropping it towards the Heroku CCLI and this you can install through the Heroku Toolbelt.
After dropping it to Heroku CCLI, you need to issue a “heroku certs”. Doing this will give you an endpoint and this will appear like this – “waterfall-9359.herokussl.com”. You will need your specific endpoint on the next step so make sure that you make a copy of it and keep it handy.
Create an Account with GoDaddy
On the next step, you need to create an account with someone just like the GoDaddy. If you do not have an alias service such as this, you will not be able to enable the SSL on your root domain, just like myapp.com or perhaps, www.myapp.com. If you have used the DNSimple, then simply proceed towards the advanced editor of your domain. You will need to add the following.
- An ALIAS record that you will use for your root URL, such as the myapp.com and this point to your Heroku issued endpoint, such as waterfall-9359.herokussl.com.
- You also need a CNAME record to be used for your www based URL, such as the www.myapp.com and this points to that same endpoint right above, such as the waterfall-9359.herokussl.com.
- You will also need CNAME records for each of the sub domain that you want to enable on your SSL, such as the blog.myapp.com, or perhaps, account.myapp.com and each pointing towards the Heroku endpoint.
So that should do it. The final step would require enabling the SSL cert on your app, which is pretty much a simple process and can be easily done by adding config.force_ssl = true to your application.rb file.