From b6a7346ef21c1a93b24eaf9785979678366ef911 Mon Sep 17 00:00:00 2001 From: Francesco Cesareo Date: Tue, 12 Mar 2024 12:31:41 +0100 Subject: [PATCH] remove x-host-* special headers --- .../java/it/gov/pagopa/forwarder/service/ProxyService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/it/gov/pagopa/forwarder/service/ProxyService.java b/src/main/java/it/gov/pagopa/forwarder/service/ProxyService.java index dcf5bbf..084c357 100644 --- a/src/main/java/it/gov/pagopa/forwarder/service/ProxyService.java +++ b/src/main/java/it/gov/pagopa/forwarder/service/ProxyService.java @@ -49,6 +49,9 @@ public class ProxyService { private static final String X_REQUEST_ID = "X-Request-Id"; private static final String OCP_APIM_SUBSCRIPTION_KEY = "Ocp-Apim-Subscription-Key"; + private static final String X_HOST_URL = "X-Host-Url"; + private static final String X_HOST_PORT = "X-Host-Port"; + private static final String X_HOST_PATH = "X-Host-Path"; @Value("${certificate.crt}") private String certificate; @@ -92,6 +95,9 @@ public ResponseEntity processProxyRequest( headers.set(HttpHeaders.HOST, xHostUrl); headers.remove(HttpHeaders.ACCEPT_ENCODING); headers.remove(OCP_APIM_SUBSCRIPTION_KEY); // remove subkey's header + headers.remove(X_HOST_URL); // remove x-host-*'s header + headers.remove(X_HOST_PORT); // remove x-host-*'s header + headers.remove(X_HOST_PATH); // remove x-host-*'s header // construct URI for the request xHostPath = xHostPath.startsWith("/") ? xHostPath : String.format("/%s", xHostPath);