Merge pull request #208 from chgl/configure-apache-proxy-strategy

Added configuration option for the ApacheProxyAddressStrategy
This commit is contained in:
Patrick Werner
2021-03-08 11:37:24 +01:00
committed by GitHub
3 changed files with 33 additions and 0 deletions

View File

@@ -27,6 +27,8 @@ import ca.uhn.fhir.narrative.INarrativeGenerator;
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
import ca.uhn.fhir.rest.server.ApacheProxyAddressStrategy;
import ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.*;
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
@@ -239,6 +241,12 @@ public class BaseJpaRestfulServer extends RestfulServer {
String serverAddress = appProperties.getServer_address();
if (!Strings.isNullOrEmpty(serverAddress)) {
setServerAddressStrategy(new HardcodedServerAddressStrategy(serverAddress));
} else if (appProperties.getUse_apache_address_strategy()) {
boolean useHttps = appProperties.getUse_apache_address_strategy_https();
setServerAddressStrategy(useHttps ? ApacheProxyAddressStrategy.forHttps() :
ApacheProxyAddressStrategy.forHttp());
} else {
setServerAddressStrategy(new IncomingRequestAddressStrategy());
}
/*