File tree 1 file changed +7
-1
lines changed
components/image-builder-bob/pkg/proxy
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,10 @@ func (proxy *Proxy) reverse(alias string) *httputil.ReverseProxy {
171
171
//
172
172
// @link https://golang.org/src/net/http/httputil/reverseproxy.go
173
173
r .Header .Set ("X-Forwarded-For" , "127.0.0.1" )
174
-
174
+ if strings .Contains (r .URL .Path , "artifacts-uploads" ) {
175
+ str := strings .SplitN (r .URL .Path , "/artifacts-uploads" , 2 )
176
+ r .URL .Path = "/artifacts-uploads" + str [1 ]
177
+ }
175
178
auth , ok := r .Context ().Value (authKey ).(docker.Authorizer )
176
179
if ! ok || auth == nil {
177
180
return
@@ -187,6 +190,9 @@ func (proxy *Proxy) reverse(alias string) *httputil.ReverseProxy {
187
190
// Some registries return a Location header which we must rewrite to still push
188
191
// through this proxy.
189
192
if loc := r .Header .Get ("Location" ); loc != "" {
193
+ // We don't want / prefix for relative URL
194
+ // As we already add a suffix of / when rewriting the url
195
+ loc = strings .TrimPrefix (loc , "/" )
190
196
lurl , err := url .Parse (loc )
191
197
if err != nil {
192
198
return err
You can’t perform that action at this time.
0 commit comments