use of org.neo4j.server.web.XForwardFilter in project neo4j by neo4j.
the class XForwardFilterTest method shouldSetTheBaseUriToTheSameProtocolAsTheXForwardProtoHeader.
@Test
public void shouldSetTheBaseUriToTheSameProtocolAsTheXForwardProtoHeader() throws Exception {
// given
final String theProtocol = "https";
XForwardFilter filter = new XForwardFilter();
InBoundHeaders headers = new InBoundHeaders();
headers.add(X_FORWARD_PROTO_HEADER_KEY, theProtocol);
ContainerRequest request = new ContainerRequest(WEB_APPLICATION, "GET", URI.create("http://jimwebber.org:1234"), URI.create("http://jimwebber.org:1234/foo/bar"), headers, INPUT_STREAM);
// when
ContainerRequest result = filter.filter(request);
// then
assertThat(result.getBaseUri().getScheme(), containsString(theProtocol));
}
use of org.neo4j.server.web.XForwardFilter in project neo4j by neo4j.
the class XForwardFilterTest method shouldSetTheRequestUriToTheSameProtocolAsTheXForwardProtoHeader.
@Test
public void shouldSetTheRequestUriToTheSameProtocolAsTheXForwardProtoHeader() throws Exception {
// given
final String theProtocol = "https";
XForwardFilter filter = new XForwardFilter();
InBoundHeaders headers = new InBoundHeaders();
headers.add(X_FORWARD_PROTO_HEADER_KEY, theProtocol);
ContainerRequest request = new ContainerRequest(WEB_APPLICATION, "GET", URI.create("http://jimwebber.org:1234"), URI.create("http://jimwebber.org:1234/foo/bar"), headers, INPUT_STREAM);
// when
ContainerRequest result = filter.filter(request);
// then
assertThat(result.getBaseUri().getScheme(), containsString(theProtocol));
}
use of org.neo4j.server.web.XForwardFilter in project neo4j by neo4j.
the class XForwardFilterTest method shouldSetTheBaseUriToTheSameValueAsTheXForwardHostHeader.
@Test
public void shouldSetTheBaseUriToTheSameValueAsTheXForwardHostHeader() throws Exception {
// given
final String xForwardHostAndPort = "jimwebber.org:1234";
XForwardFilter filter = new XForwardFilter();
InBoundHeaders headers = new InBoundHeaders();
headers.add(X_FORWARD_HOST_HEADER_KEY, xForwardHostAndPort);
ContainerRequest request = new ContainerRequest(WEB_APPLICATION, "GET", URI.create("http://iansrobinson.com"), URI.create("http://iansrobinson.com/foo/bar"), headers, INPUT_STREAM);
// when
ContainerRequest result = filter.filter(request);
// then
assertThat(result.getBaseUri().toString(), containsString(xForwardHostAndPort));
}
use of org.neo4j.server.web.XForwardFilter in project neo4j by neo4j.
the class XForwardFilterTest method shouldSetTheRequestUriToTheSameValueAsTheXForwardHostHeader.
@Test
public void shouldSetTheRequestUriToTheSameValueAsTheXForwardHostHeader() throws Exception {
// given
final String xForwardHostAndPort = "jimwebber.org:1234";
XForwardFilter filter = new XForwardFilter();
InBoundHeaders headers = new InBoundHeaders();
headers.add(X_FORWARD_HOST_HEADER_KEY, xForwardHostAndPort);
ContainerRequest request = new ContainerRequest(WEB_APPLICATION, "GET", URI.create("http://iansrobinson.com"), URI.create("http://iansrobinson.com/foo/bar"), headers, INPUT_STREAM);
// when
ContainerRequest result = filter.filter(request);
// then
assertTrue(result.getRequestUri().toString().startsWith("http://" + xForwardHostAndPort));
}
Aggregations