Skip to content

Support multiple comma-separated values in X-Forwarded-Host header [SPR-11140] #15766

Closed
@spring-projects-issues

Description

@spring-projects-issues

Chris Pimlott opened SPR-11140 and commented

The support for the X-Forwarded-Host header added in #14743 does not account for having multiple comma-separated hosts in the header, e.g.:

X-Forwarded-Host: foo.com, bar.com, baz.com

Test case:

  @Test
  public void testMultiValuedXForwardedHostHeader() {
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addHeader("X-Forwarded-Host", "a.example.org, b.example.org, c.example.org");

    assertEquals("a.example.org", ServletUriComponentsBuilder.fromRequest(request).build().getHost());
  }

Affects: 3.2.5

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions