fix(lastfm): make a better guess at callback protocol when incoming connection is TLS

closes: #213

Co-authored-by: Brian Doherty <brian.r.doherty@gmail.com>
This commit is contained in:
sentriz
2022-04-20 23:09:25 +01:00
parent 611bc96e29
commit 4658d07273

View File

@@ -56,8 +56,12 @@ func (c *Controller) Path(rel string) string {
}
func (c *Controller) BaseURL(r *http.Request) string {
protocol := "http"
if r.TLS != nil {
protocol = "https"
}
scheme := firstExisting(
"http", // fallback
protocol, // fallback
r.Header.Get("X-Forwarded-Proto"),
r.Header.Get("X-Forwarded-Scheme"),
r.URL.Scheme,