mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
use https if proxied (#2033)
This commit is contained in:
@@ -116,7 +116,7 @@ func proxyHomeHandler(c *config.Config) http.HandlerFunc {
|
|||||||
|
|
||||||
// if the host does not have a scheme, add one based on the request
|
// if the host does not have a scheme, add one based on the request
|
||||||
if !strings.HasPrefix(templateData["Host"], "http://") && !strings.HasPrefix(templateData["Host"], "https://") {
|
if !strings.HasPrefix(templateData["Host"], "http://") && !strings.HasPrefix(templateData["Host"], "https://") {
|
||||||
if r.TLS != nil {
|
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
|
||||||
templateData["Host"] = "https://" + templateData["Host"]
|
templateData["Host"] = "https://" + templateData["Host"]
|
||||||
} else {
|
} else {
|
||||||
templateData["Host"] = "http://" + templateData["Host"]
|
templateData["Host"] = "http://" + templateData["Host"]
|
||||||
|
|||||||
Reference in New Issue
Block a user