Skip to content

Commit 7761b62

Browse files
authored
Merge pull request #10 from onprem/prefix
Add prefix header with value '/' to forwarded requests
2 parents fb2d413 + e93b31b commit 7761b62

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030

3131
const (
3232
retryInterval = 5 * time.Second
33+
prefixHeader = "X-Forwarded-Prefix"
3334
)
3435

3536
type config struct {
@@ -234,6 +235,9 @@ func main() {
234235
request.URL.Host = cfg.url.Host
235236
// Derive path from the paths of configured URL and request URL.
236237
request.URL.Path, request.URL.RawPath = joinURLPath(cfg.url, request.URL)
238+
// Add prefix header with value "/", since from a client's perspective
239+
// we are forwarding /<anything> to /<cfg.url.Path>/<anything>.
240+
request.Header.Add(prefixHeader, "/")
237241
},
238242
}
239243
p.Transport = &oauth2.Transport{

0 commit comments

Comments
 (0)