MCPcopy Create free account
hub / github.com/zalando/skipper / forwardToProxy

Function forwardToProxy

proxy/proxy.go:728–738  ·  view source on GitHub ↗
(incoming, outgoing *http.Request)

Source from the content-addressed store, hash-verified

726type proxyUrlContextKey struct{}
727
728func forwardToProxy(incoming, outgoing *http.Request) *http.Request {
729 proxyURL := &url.URL{
730 Scheme: outgoing.URL.Scheme,
731 Host: outgoing.URL.Host,
732 }
733
734 outgoing.URL.Host = incoming.Host
735 outgoing.URL.Scheme = schemeFromRequest(incoming)
736
737 return outgoing.WithContext(stdlibcontext.WithValue(outgoing.Context(), proxyUrlContextKey{}, proxyURL))
738}
739
740func proxyFromContext(req *http.Request) (*url.URL, error) {
741 proxyURL, _ := req.Context().Value(proxyUrlContextKey{}).(*url.URL)

Callers 2

mapRequestMethod · 0.85
TestForwardToProxyFunction · 0.85

Calls 2

schemeFromRequestFunction · 0.85
ContextMethod · 0.80

Tested by 1

TestForwardToProxyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…