Attempting to get completely free SSL on Heroku using Cloudflares new free Universal SSL
Read this article:
http://mikecoutermarsh.com/adding-ssl-to-heroku-with-cloudflare/
Which seems to suggest its possible now that Cloudflare offers SSL for free.
The steps I took:
- Set up my DNS with Cloudflare (free account)
- Forwarded my domain to my herokuapp (CNAME example-app.com -> example-app.herokuapp.com)
- Set the Cloudflare SSL option to 'Full SSL'
- Added my domain to my heroku app
Forcing https with this express middleware:
app.use(function(req, res, next) {
if (req.headers['x-forwarded-proto'] != 'https') {
res.redirect('https://' + req.headers.host + req.path);
}
else {
return next();
}
});
The heroku domain http://example-app.herokuapp.com works correctly and redirects to https://example-app.herokuapp.com, green lock and all.
Both http://example-app.com and https://example-app.com do not work. The browser tab icon just keeps spinning and never resolves. Any ideas on how to get this working? Is this even possible?
*UPDATE
This is looking like it IS actually possible. From CloudFlare support:
Hi Bill,
Fundamentally, as long as the "origin" supports an SSL connection you can use Full SSL with CloudFlare.
Simon
CloudFlare released this blog post today:
https://blog.cloudflare.com/universal-ssl-be-just-a-bit-more-patient/
My site has started resolving, but getting a "Your connection is not private" message like in the "Errors you may see" part of the blog post. Also in my CloudFlare settings there is a "SSL issuing" alert, so I imagine once it is issued this may just work. I'll keep y'all posted.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…