mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 07:21:26 +02:00
run as non root and non host network mode
This commit is contained in:
@@ -22,7 +22,7 @@ func (redirectHTTP) before(w http.ResponseWriter, r *http.Request) (proceed bool
|
||||
if i := strings.Index(host, ":"); i != -1 {
|
||||
host = host[:i] // strip port number if present
|
||||
}
|
||||
r.URL.Host = host + ":" + common.ProxyHTTPSPort
|
||||
r.URL.Host = host + common.ProxyHTTPSAddr
|
||||
logging.Debug().Str("url", r.URL.String()).Msg("redirect to https")
|
||||
http.Redirect(w, r, r.URL.String(), http.StatusTemporaryRedirect)
|
||||
return true
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestRedirectToHTTPs(t *testing.T) {
|
||||
})
|
||||
ExpectNoError(t, err)
|
||||
ExpectEqual(t, result.ResponseStatus, http.StatusTemporaryRedirect)
|
||||
ExpectEqual(t, result.ResponseHeaders.Get("Location"), "https://example.com:"+common.ProxyHTTPSPort)
|
||||
ExpectEqual(t, result.ResponseHeaders.Get("Location"), "https://example.com"+common.ProxyHTTPSAddr)
|
||||
}
|
||||
|
||||
func TestNoRedirect(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user