mehrancodes/laravel-harbor

Environment URL points to http:// even when SSL is configured; wait_on_ssl not currently used?

gbradley opened this issue · 3 comments

When creating a site with FORGE_SSL_REQUIRED set to true, the comment added to GitHub contains the environment variable using the http protocol rather than https.

At first I assumed this is due to the ForgeServce's getSiteLink() method being called on the newly created site, which will have isSecured as false until the LetsEncrypt process completes. According to the docs, FORGE_WAIT_ON_SSL defaults to true; I can see it being used to set the wait_on_ssl config variable, but that doesn't seem to be used anywhere?

Happy to try a PR but would be good to know if wait_on_ssl was intended to be usable or not.

We are assigning the env keys to CamelCase properties after validation is done here, and using waitOnSsl property here to tell Forge wait on SSL. Forge is expected to wait on SSL certification when wait_on_ssl is set to True.

However I appreciate any help on debugging the Forge's isSecured property.

I think we also should be fine to set https on getSiteLink if the sslRequired() is True (since some projects may need to skip waiting on certification), ensuring to throw an exception if we got error on certification. What do you think?

Ah I see. Could it just be that the isSecured property isn’t refreshed after the certificate is created?

Rather than fetching the site data again, I’d say it’s safe to assume an HTTPS url if the user has requested it (since an exception will be thrown if SSL fails).

Agreed! It's fine to do so after the certification is done either by re-fetching the site and assigning it back to ForgeService->site or by changing ForgeSetting->site->isSecured value. both works well IMO