Skip to content

Commit

Permalink
fix(lastfm): make a better guess at callback protocol when incoming c…
Browse files Browse the repository at this point in the history
…onnection is TLS

closes: #213

Co-authored-by: Brian Doherty <brian.r.doherty@gmail.com>
  • Loading branch information
sentriz and brian-doherty committed Apr 20, 2022
1 parent 611bc96 commit 4658d07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/ctrlbase/ctrl.go
Expand Up @@ -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,
Expand Down

0 comments on commit 4658d07

Please sign in to comment.