Added a hard redirect as well as the .well-known hint

This commit is contained in:
Steve Hay
2022-09-22 15:25:41 -04:00
parent b5f5b0819d
commit 2df7bac979
+4 -1
View File
@@ -139,7 +139,10 @@ def make_domain_config(domain, templates, ssl_certificates, env):
# Add .well-known redirects for CalDAV and CardDAV to TLD, which may make for better service discovery # Add .well-known redirects for CalDAV and CardDAV to TLD, which may make for better service discovery
if len(domain.split('.'))==2: if len(domain.split('.'))==2:
nginx_conf_extra += f"\n\trewrite ^/.well-known/caldav https://{env['PRIMARY_HOSTNAME']}/cloud/remote.php/dav/ redirect;" nginx_conf_extra += f"\n\trewrite ^/.well-known/caldav https://{env['PRIMARY_HOSTNAME']}/cloud/remote.php/dav/ redirect;"
nginx_conf_extra += f"\n\trewrite ^/.well-known/carddav https://{env['PRIMARY_HOSTNAME']}/cloud/remote.php/dav/ redirect;\n\n" nginx_conf_extra += f"\n\trewrite ^/.well-known/carddav https://{env['PRIMARY_HOSTNAME']}/cloud/remote.php/dav/ redirect;\n"
nginx_conf_extra += f"\n\tlocation /dav {{"
nginx_conf_extra += f"\n\t\treturn 301 https://{env['PRIMARY_HOSTNAME']}/cloud/remote.php$request_uri;"
nginx_conf_extra += f"\n\t}}\n"
# Because the certificate may change, we should recognize this so we # Because the certificate may change, we should recognize this so we
# can trigger an nginx update. # can trigger an nginx update.