Free SSL setup on Heroku for a react-app using LetsEncrypt

632 Views Asked by At

To start with I really don't want to pay for hobby dyno on heroku. I am well aware of their ACM process. I am trying to be a little careful with spends as I am testing something.

My current setup is as follows:

Namecheap (domain xyz.com) -> xyz.herokuapp.com (with DNS Name configured correctly)

This is configured correctly and works great for HTTP. I have a task at hand to obtain certifactes from LetsEncrypt (because they are free), and integrated it to app deployed on heroku.

The app is a simple react-app, built using create-react-app. I have followed the steps to obtain a certificate from LetsEncrypt, and the certbot is asking me to place the certificate in this path public/.well-known/acme-challenge/<cert-string>. The content of the file in that path contains the .

The problem I am having is, the route localhost:3000/.well-known/acme-challenge/<cert-string> works well in my dev environment. When I deployed the react app to heroku, the route /.well-known/acme-challenge/<cert-string> is heading to a 304 and I am unable to facilitate the certbot to complete the validation step.

After a few hours of debugging I understood the architecture inside heroku better, and I have understood that this is a heroku buildpack related problem. My current understanding of the issue is as follows:

  • heroku blocks access to /.well-known/acme-challenge/<cert-string>
  • and I have to find a way to unblock this ^ .. so that certbot can validate my cert process.

I did some research and understood that there is a way to by-pass the nginx.conf. Is this really possible?

Looking for some guidance here.


Edit1

I have tried some approaches here https://github.com/heroku/heroku-buildpack-php/issues/218 - they did not work well.

0

There are 0 best solutions below