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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user