Commit 3e8874ed authored by Federico G. Schwindt's avatar Federico G. Schwindt Committed by Lasse Karstensen

Collapse multiple X-Forwarded-For headers

Fixes #1650
parent 2f5d19f6
......@@ -724,6 +724,7 @@ cnt_recv(struct worker *wrk, struct req *req)
* This really should be done earlier, but we want to capture
* it in the VSL log.
*/
http_CollectHdr(req->http, H_X_Forwarded_For);
if (http_GetHdr(req->http, H_X_Forwarded_For, &xff)) {
http_Unset(req->http, H_X_Forwarded_For);
http_PrintfHeader(req->http, "X-Forwarded-For: %s, %s",
......
varnishtest "xff handling discards multiple headers"
server s1 {
rxreq
expect req.http.X-Forwarded-For == "1.2.3.4, 5.6.7.8, 127.0.0.1"
txresp
} -start
varnish v1 -vcl+backend {
} -start
client c1 {
txreq -hdr "X-Forwarded-For: 1.2.3.4" -hdr "X-Forwarded-For: 5.6.7.8"
rxresp
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment