0

I'm setting up Let's Encrypt to issue certificates automatically. Each user will have their own subdomain so I need to create certificates in batch every so many hours to avoid LE's rate limits.

Between the time they sign up and the time their certificate is ready I want to serve their subdomain over HTTP. As long as the certificate exists, the action should be to always redirect HTTP to HTTPS. Bonus if we can check the validity of the certificate. Suggestions?

  • Does'nt let's encrypt do that for you when you are requesting a certificate from them? – Orphans Mar 9 '17 at 13:23
  • nah, the request process doesn't control nginx's server block logic – Garet Claborn Mar 9 '17 at 13:25
2

Why not make adjusting nginx part of the same script that handles the batch requests?

You could for example create a bit of code in a configuration management tool (e.g. ansible), that created an HTTP-only virtual host if a given certificate was not seen, and an HTTPS virtual host when the certificate is actually available.

You could then either make your existing script call your configuration management tool at the end of its run, or even simply run your configuration management tool periodically.

Depending on what kind of service you are providing users, though, it may not be desirable to allow HTTP access (notably if it is likely the first thing they will do is to try and log on to that service).

  • hi thanks for the response. it is a viable solution but I am attempting to avoid switching configurations around. right now i am able to verify new domains without reloading configs which we see as more stable. if we can't find any other way then we will probably consider this the plan B. on the note about user login, not to worry all authenticated activity/login is on the root domain and 'service' subdomain only. these subdomains contain generated content and the HTTPS is just for good practice and catching referrer from google etc.. – Garet Claborn Mar 9 '17 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.