From 1e5a7220290479caba774fbabb52512c5783f790 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 26 Jul 2023 23:35:38 +0300 Subject: [PATCH] Add Cleartext sync bug troubleshooting logs --- .../gateway/BearerAuthorizationInterceptor.java | 7 +++++++ .../com/google/fhir/gateway/FhirProxyServer.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/server/src/main/java/com/google/fhir/gateway/BearerAuthorizationInterceptor.java b/server/src/main/java/com/google/fhir/gateway/BearerAuthorizationInterceptor.java index 7cf0be64..ef60fdcd 100755 --- a/server/src/main/java/com/google/fhir/gateway/BearerAuthorizationInterceptor.java +++ b/server/src/main/java/com/google/fhir/gateway/BearerAuthorizationInterceptor.java @@ -360,6 +360,13 @@ private void replaceAndCopyResponse(Reader entityContentReader, Writer writer, S // matching can be done more efficiently if needed, but we should avoid loading the full // stream in memory. String fhirStoreUrl = fhirClient.getBaseUrl(); + + logger.error( + "######################## --- replaceAndCopyResponse --- ###########################"); + logger.error( + String.format("Replacing Base URL %s with Proxy Base %s", fhirStoreUrl, proxyBase)); + logger.error("###################################################"); + int numMatched = 0; int n; while ((n = entityContentReader.read()) >= 0) { diff --git a/server/src/main/java/com/google/fhir/gateway/FhirProxyServer.java b/server/src/main/java/com/google/fhir/gateway/FhirProxyServer.java index 6621a7f6..56d524b5 100644 --- a/server/src/main/java/com/google/fhir/gateway/FhirProxyServer.java +++ b/server/src/main/java/com/google/fhir/gateway/FhirProxyServer.java @@ -17,6 +17,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.server.ApacheProxyAddressStrategy; import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor; import com.google.fhir.gateway.GenericFhirClient.GenericFhirClientBuilder; @@ -108,6 +109,21 @@ protected void initialize() throws ServletException { } catch (IOException e) { ExceptionUtil.throwRuntimeExceptionAndLog(logger, "IOException while initializing", e); } + + logger.error( + "######################## --- initialize BEFORE Setting Address Strategy ---" + + " ###########################"); + logger.error( + String.format("Current Address Strategy class %s", this.getServerAddressStrategy())); + logger.error("###################################################\n"); + + setServerAddressStrategy(new ApacheProxyAddressStrategy(true)); + + logger.error( + "######################## --- initialize AFTER Setting Address Strategy ---" + + " ###########################"); + logger.error(String.format("New Address Strategy class %s", this.getServerAddressStrategy())); + logger.error("###################################################\n"); } private HttpFhirClient chooseHttpFhirClient(String backendType, String fhirStore)