cloudpanel-io / vhost-templates

Application Vhost Templates for CloudPanel
https://www.cloudpanel.io
49 stars 43 forks source link

Moodle 4 vhost template fix #19

Closed fizikiukas closed 10 months ago

fizikiukas commented 11 months ago

At the moment, the Moodle 4 vhost template redirects all traffic to HTTPS, which interferes with the Let's encrypt certificate issue.

Since you can set HTTPS redirection inside Moodle or while installing it, I don't think it is needed in vhost template. This would also allow the installation Let's encrypt without any changes on vhost.

I would suggest commenting out:

if ($scheme != "https") { rewrite ^ https://$host$uri permanent; }

Just as it is done in PrestShop vhost: https://github.com/cloudpanel-io/vhost-templates/blob/master/v2/PrestaShop/PrestaShop%201.7#L16

Also, this kind of redirect would also work:

set $redirect_to_https 0;

if ($scheme != "https") { set $redirect_to_https 1; }

if ($request_uri ~ ^/.well-known) { set $redirect_to_https 0; }

if ($redirect_to_https = 1) { return 301 https://$host$request_uri; }