mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
fix: use request.URL.Host if set (#2069)
This commit is contained in:
@@ -109,6 +109,11 @@ func proxyHomeHandler(c *config.Config) http.HandlerFunc {
|
||||
// This should be correct in most cases. If it is not, users can supply their own template
|
||||
templateData["Host"] = r.Host
|
||||
|
||||
// use host from URL, if it exists
|
||||
if r.URL.Host != "" {
|
||||
templateData["Host"] = r.URL.Host
|
||||
}
|
||||
|
||||
// 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 r.TLS != nil {
|
||||
|
||||
Reference in New Issue
Block a user