diff --git a/java/server/src/org/openqa/selenium/grid/server/NetworkOptions.java b/java/server/src/org/openqa/selenium/grid/server/NetworkOptions.java index c6852cb0e0e1c..158662215e4a7 100644 --- a/java/server/src/org/openqa/selenium/grid/server/NetworkOptions.java +++ b/java/server/src/org/openqa/selenium/grid/server/NetworkOptions.java @@ -36,8 +36,7 @@ public class NetworkOptions { private final Config config; // These are commonly used by process which can't set various headers. - // Checks are skipped when the session already exists - private final Set SKIP_CHECKS_ON = ImmutableSet.of("/status", "/readyz", "\\/session\\/(.*)"); + private final Set SKIP_CHECKS_ON = ImmutableSet.of("/status", "/readyz"); public NetworkOptions(Config config) { this.config = Require.nonNull("Config", config); diff --git a/java/server/src/org/openqa/selenium/grid/web/CheckContentTypeHeader.java b/java/server/src/org/openqa/selenium/grid/web/CheckContentTypeHeader.java index 42d7583cbf94a..a4c22f00fe121 100644 --- a/java/server/src/org/openqa/selenium/grid/web/CheckContentTypeHeader.java +++ b/java/server/src/org/openqa/selenium/grid/web/CheckContentTypeHeader.java @@ -50,7 +50,7 @@ public HttpHandler apply(HttpHandler httpHandler) { Require.nonNull("Next handler", httpHandler); return req -> { - if (skipChecksOn.stream().anyMatch(s -> req.getUri().matches(s))) { + if (skipChecksOn.contains(req.getUri())) { return httpHandler.execute(req); } diff --git a/java/server/test/org/openqa/selenium/grid/web/EnsureSpecCompliantHeadersTest.java b/java/server/test/org/openqa/selenium/grid/web/EnsureSpecCompliantHeadersTest.java index 723898549412c..2933b0757e6a7 100644 --- a/java/server/test/org/openqa/selenium/grid/web/EnsureSpecCompliantHeadersTest.java +++ b/java/server/test/org/openqa/selenium/grid/web/EnsureSpecCompliantHeadersTest.java @@ -25,8 +25,6 @@ import org.openqa.selenium.remote.http.HttpRequest; import org.openqa.selenium.remote.http.HttpResponse; -import java.util.UUID; - import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR; import static java.net.HttpURLConnection.HTTP_OK; import static org.assertj.core.api.Assertions.assertThat; @@ -56,15 +54,6 @@ public void shouldAllowRequestsWithNoContentTypeWhenSkipCheckOnMatches() { assertThat(res.getStatus()).isEqualTo(HTTP_OK); } - @Test - public void shouldAllowRequestsWithNoContentTypeWhenSkipCheckOnMatchesRegex() { - HttpResponse res = new EnsureSpecCompliantHeaders(ImmutableList.of(), ImmutableSet.of("\\/paipa\\/(.*)")) - .apply(alwaysOk) - .execute(new HttpRequest(POST, String.format("/paipa/%s", UUID.randomUUID().toString()))); - - assertThat(res.getStatus()).isEqualTo(HTTP_OK); - } - @Test public void requestsWithAnOriginHeaderShouldBeBlocked() { HttpResponse res = new EnsureSpecCompliantHeaders(ImmutableList.of(), ImmutableSet.of())