add option to handle autoconfig and mta-sts requests without TLS, for when it is reverse proxied

for #5 with hints from belst & idnovic
This commit is contained in:
Mechiel Lukkien
2023-02-25 11:28:15 +01:00
parent ac3a3e496e
commit 0ede7f78c1
5 changed files with 28 additions and 10 deletions

View File

@ -110,12 +110,12 @@ func ListenAndServe() {
}))
}
if l.AutoconfigHTTPS.Enabled {
srv := ensureServe(true, config.Port(l.AutoconfigHTTPS.Port, 443), "autoconfig-https")
srv := ensureServe(!l.AutoconfigHTTPS.NonTLS, config.Port(l.AutoconfigHTTPS.Port, 443), "autoconfig-https")
srv.mux.HandleFunc("/mail/config-v1.1.xml", safeHeaders(autoconfHandle(l)))
srv.mux.HandleFunc("/autodiscover/autodiscover.xml", safeHeaders(autodiscoverHandle(l)))
}
if l.MTASTSHTTPS.Enabled {
srv := ensureServe(true, config.Port(l.MTASTSHTTPS.Port, 443), "mtasts-https")
srv := ensureServe(!l.AutoconfigHTTPS.NonTLS, config.Port(l.MTASTSHTTPS.Port, 443), "mtasts-https")
srv.mux.HandleFunc("/.well-known/mta-sts.txt", safeHeaders(mtastsPolicyHandle))
}
if l.PprofHTTP.Enabled {