mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
fix(app): give proxy handlers a request that owns its strings
The fiber adaptor builds the URL, Host, Method and header strings of the net/http request over the fasthttp request buffer. The next request on the connection overwrites that buffer. The proxies pass these strings to background scans, singleflight keys and analytics, which outlive the request. Each proxy route now receives a copy.
This commit is contained in:
+6
-6
@@ -542,9 +542,9 @@ func (a *App) setupServer() error {
|
||||
a.prewarmFetcher.Mount("go", goProxyMounted)
|
||||
goProxyWithCDN := a.cdnMiddleware.Handler(goProxyMounted)
|
||||
if authEnabled {
|
||||
a.app.All("/go/*", mwAuth, adaptor.HTTPHandler(goProxyWithCDN))
|
||||
a.app.All("/go/*", mwAuth, proxyHandler(goProxyWithCDN))
|
||||
} else {
|
||||
a.app.All("/go/*", adaptor.HTTPHandler(goProxyWithCDN))
|
||||
a.app.All("/go/*", proxyHandler(goProxyWithCDN))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,9 +566,9 @@ func (a *App) setupServer() error {
|
||||
return c.Next()
|
||||
})
|
||||
if authEnabled {
|
||||
a.app.All("/npm/*", mwAuth, adaptor.HTTPHandler(npmProxyWithCDN))
|
||||
a.app.All("/npm/*", mwAuth, proxyHandler(npmProxyWithCDN))
|
||||
} else {
|
||||
a.app.All("/npm/*", adaptor.HTTPHandler(npmProxyWithCDN))
|
||||
a.app.All("/npm/*", proxyHandler(npmProxyWithCDN))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,9 +584,9 @@ func (a *App) setupServer() error {
|
||||
a.prewarmFetcher.Mount("pypi", pypiProxyMounted)
|
||||
pypiProxyWithCDN := a.cdnMiddleware.Handler(pypiProxyMounted)
|
||||
if authEnabled {
|
||||
a.app.All("/pypi/*", mwAuth, adaptor.HTTPHandler(pypiProxyWithCDN))
|
||||
a.app.All("/pypi/*", mwAuth, proxyHandler(pypiProxyWithCDN))
|
||||
} else {
|
||||
a.app.All("/pypi/*", adaptor.HTTPHandler(pypiProxyWithCDN))
|
||||
a.app.All("/pypi/*", proxyHandler(pypiProxyWithCDN))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user