@@ -66,7 +66,8 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
66
66
Body ().
67
67
Raw ()
68
68
69
- assert .Contains (ginkgo .GinkgoT (), body , "host=myhost" )
69
+ // we use a regexp to prevent matching the expression in the middle of the x-original-forwarded-host header
70
+ assert .Regexp (ginkgo .GinkgoT (), `(\s)host=myhost` , body )
70
71
assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost" )
71
72
assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-proto=myproto" )
72
73
assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-scheme=myproto" )
@@ -86,7 +87,8 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
86
87
Body ().
87
88
Raw ()
88
89
89
- assert .Contains (ginkgo .GinkgoT (), body , "host=myhost.com" )
90
+ // we use a regexp to prevent matching the expression in the middle of the x-original-forwarded-host header
91
+ assert .Regexp (ginkgo .GinkgoT (), `(\s)host=myhost.com` , body )
90
92
assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost.com" )
91
93
})
92
94
@@ -121,7 +123,9 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
121
123
assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-proto=http" )
122
124
assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-scheme=http" )
123
125
assert .Contains (ginkgo .GinkgoT (), body , "x-original-forwarded-for=1.2.3.4" )
124
- assert .NotContains (ginkgo .GinkgoT (), body , "host=myhost" )
126
+ assert .Contains (ginkgo .GinkgoT (), body , "x-original-forwarded-host=myhost" )
127
+ // we use a regexp to prevent matching the expression in the middle of the x-original-forwarded-host header
128
+ assert .NotRegexp (ginkgo .GinkgoT (), `(\s)host=myhost` , body )
125
129
assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost" )
126
130
assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-proto=myproto" )
127
131
assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-scheme=myproto" )
0 commit comments