mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 20:57:20 +00:00
Extend proxy test to test all URL rewriting cases.
This commit is contained in:
@@ -178,11 +178,16 @@ func (t *proxyTransport) updateURLs(n *html.Node, sourceURL *url.URL) {
|
||||
continue
|
||||
}
|
||||
// Is this URL relative?
|
||||
if url.Host == "" || url.Host == sourceURL.Host {
|
||||
if url.Host == "" {
|
||||
url.Scheme = t.proxyScheme
|
||||
url.Host = t.proxyHost
|
||||
url.Path = path.Join(t.proxyPathPrepend, path.Dir(sourceURL.Path), url.Path, "/")
|
||||
n.Attr[i].Val = url.String()
|
||||
} else if url.Host == sourceURL.Host {
|
||||
url.Scheme = t.proxyScheme
|
||||
url.Host = t.proxyHost
|
||||
url.Path = path.Join(t.proxyPathPrepend, url.Path)
|
||||
n.Attr[i].Val = url.String()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user