File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ The following HAProxy configuration snippet shows this process:
9393# a protected backend
9494backend be_protected
9595 # set required headers
96- http-request set-header X-Forward -For %[src]
96+ http-request set-header X-Forwarded -For %[src]
9797 http-request set-header X-Forwarded-Proto %[ssl_fc,iif(https,http)]
9898 http-request set-header X-Forwarded-Host %[req.hdr(Host)]
9999 http-request set-header X-Forwarded-Uri %[capture.req.uri]
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ import (
1515)
1616
1717func main () {
18- // logging
1918 // command line flags
2019 pflag .String ("listen" , "127.0.0.1:3000" , "Listen address" )
2120 pflag .String ("url" , "http://127.0.0.1:9091/api/authz/forward-auth" , "URL to perform verification against" )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ backend be_protected
5454 mode http
5555
5656 # set required headers
57- http-request set-header X-Forward -For %[src]
57+ http-request set-header X-Forwarded -For %[src]
5858 http-request set-header X-Forwarded-Proto %[ssl_fc,iif(https,http)]
5959 http-request set-header X-Forwarded-Host %[req.hdr(Host)]
6060 http-request set-header X-Forwarded-Uri %[capture.req.uri]
Original file line number Diff line number Diff line change @@ -114,6 +114,14 @@ func (auth *AuthHandler) Handler(req *request.Request) {
114114 }
115115 }
116116
117+ // set cookie if present
118+ if cookies := res .Cookies (); len (cookies ) == 1 {
119+ if v := cookies [0 ].String (); v != "" {
120+ req .Actions .SetVar (action .ScopeRequest , "response_cookie.name" , cookies [0 ].Name )
121+ req .Actions .SetVar (action .ScopeRequest , "response_cookie.value" , v )
122+ }
123+ }
124+
117125 logger .Info ("message handled" )
118126 return
119127 }
You can’t perform that action at this time.
0 commit comments