Skip to content

Commit 50c0056

Browse files
committed
fix: req.RequestURI unreliable
Signed-off-by: Eric Lin <38420555+Ezzahhh@users.noreply.github.com>
1 parent 70e3767 commit 50c0056

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (e *VouchPlugin) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
8585
authReq.AddCookie(cookie)
8686
}
8787
// Pass X-Original-URI so Vouch knows what we accessed
88-
authReq.Header.Set("X-Original-URI", req.RequestURI)
88+
authReq.Header.Set("X-Original-URI", req.URL.RequestURI())
8989
// Pass other standard headers
9090
if req.TLS != nil || req.Header.Get("X-Forwarded-Proto") == "https" {
9191
authReq.Header.Set("X-Forwarded-Proto", "https")
@@ -137,7 +137,7 @@ func (e *VouchPlugin) handleRedirect(rw http.ResponseWriter, req *http.Request,
137137
if h := req.Header.Get("X-Forwarded-Host"); h != "" {
138138
host = h
139139
}
140-
fullOriginalURL := fmt.Sprintf("%s://%s%s", scheme, host, req.RequestURI)
140+
fullOriginalURL := fmt.Sprintf("%s://%s%s", scheme, host, req.URL.RequestURI())
141141

142142
// 2. REPLICATE: The auth_request_set logic
143143
// Nginx: auth_request_set $auth_resp_failcount $upstream_http_x_vouch_failcount;

0 commit comments

Comments
 (0)