Home
Support Forums

Programmatically force HTTPS via API

Is there a way to programmatically force HTTPS over the API? i.e. in the same way that you can manually do it on the dashboard. Apologies if this is obvious i’m new to Netlify’s DNS features. I understand that the manual provisioning of the SSL certificate is only a bit faster than the automatic provisioning but I could really use the ability to force it programmatically as soon as the site is live.

My use case has to do with deploying multiple instances the same app to multiple customers under custom subdomains so the time it takes to fully provision this matters. Let me know if I’m missing something obvious.

I think your issue is different than what you’re asking. You are asking if it’s possible to force HTTp → HTTPS redirect and the issue at hand is that you don’t want to wait for SSL certificate to be provisioned.

There’s no way to force provisioning via API because this API calls (that Netlify makes to LetsEncrypt) are highly rate limited. if we overdo it, your site won’t have HTTPS for a long time. If DNS is configured correctly. SSL certificate does’t take long to be available.

Ah right that makes sense thanks!

SSL doesn’t take long indeed - I was confused by the notification asking if I wanted to force HTTPS that seems to persist even after the certificate is provisioned.

Yes, that might be true, but Netlify automatically redirects to HTTPS once it’s confident the SSL is working fine everywhere. So, that should not be a problem.

1 Like