@@ -66,7 +66,8 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
6666 Body ().
6767 Raw ()
6868
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 )
7071 assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost" )
7172 assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-proto=myproto" )
7273 assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-scheme=myproto" )
@@ -86,7 +87,8 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
8687 Body ().
8788 Raw ()
8889
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 )
9092 assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost.com" )
9193 })
9294
@@ -121,7 +123,9 @@ var _ = framework.DescribeSetting("use-forwarded-headers", func() {
121123 assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-proto=http" )
122124 assert .Contains (ginkgo .GinkgoT (), body , "x-forwarded-scheme=http" )
123125 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 )
125129 assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-host=myhost" )
126130 assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-proto=myproto" )
127131 assert .NotContains (ginkgo .GinkgoT (), body , "x-forwarded-scheme=myproto" )
0 commit comments