Support multi-value x-forwarded-host header

Issue: SPR-11140
This commit is contained in:
Rossen Stoyanchev
2013-12-03 09:55:47 -05:00
parent 6ce2eb9622
commit 236981aaa9
2 changed files with 16 additions and 5 deletions

View File

@@ -107,6 +107,15 @@ public class ServletUriComponentsBuilderTests {
assertEquals(443, result.getPort());
}
// SPR-11140
@Test
public void fromRequestWithForwardedHostMultiValuedHeader() {
this.request.addHeader("X-Forwarded-Host", "a.example.org, b.example.org, c.example.org");
assertEquals("a.example.org", ServletUriComponentsBuilder.fromRequest(this.request).build().getHost());
}
@Test
public void fromContextPath() {
request.setRequestURI("/mvc-showcase/data/param");