@@ -66,6 +66,7 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
66
66
Body ().
67
67
Raw ()
68
68
69
+ // we use a regexp to prevent matching the expression in the middle of the x-original-forwarded-host header
69
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" )
@@ -86,7 +87,8 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
86
87
Body ().
87
88
Raw ()
88
89
89
- assert .Regexp (ginkgo .GinkgoT (), `(\s)host=myhost` , body )
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
@@ -122,6 +124,7 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
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
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
125
128
assert .NotRegexp (ginkgo .GinkgoT (), `(\s)host=myhost` , body )
126
129
assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost" )
127
130
assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-proto=myproto" )
0 commit comments