added apache proxy address strategy as a config option
This commit is contained in:
@@ -66,6 +66,25 @@ public class AppProperties {
|
|||||||
|
|
||||||
private Boolean lastn_enabled = false;
|
private Boolean lastn_enabled = false;
|
||||||
|
|
||||||
|
private Boolean use_apache_address_strategy = false;
|
||||||
|
private Boolean use_apache_address_strategy_https = false;
|
||||||
|
|
||||||
|
public Boolean getUse_apache_address_strategy() {
|
||||||
|
return use_apache_address_strategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUse_apache_address_strategy(Boolean use_apache_address_strategy) {
|
||||||
|
this.use_apache_address_strategy = use_apache_address_strategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getUse_apache_address_strategy_https() {
|
||||||
|
return use_apache_address_strategy_https;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUse_apache_address_strategy_https(Boolean use_apache_address_strategy_https) {
|
||||||
|
this.use_apache_address_strategy_https = use_apache_address_strategy_https;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getDefer_indexing_for_codesystems_of_size() {
|
public Integer getDefer_indexing_for_codesystems_of_size() {
|
||||||
return defer_indexing_for_codesystems_of_size;
|
return defer_indexing_for_codesystems_of_size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import ca.uhn.fhir.narrative.INarrativeGenerator;
|
|||||||
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
|
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
|
||||||
import ca.uhn.fhir.rest.server.ETagSupportEnum;
|
import ca.uhn.fhir.rest.server.ETagSupportEnum;
|
||||||
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
|
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.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.*;
|
import ca.uhn.fhir.rest.server.interceptor.*;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
|
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
|
||||||
@@ -232,6 +234,12 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
|||||||
String serverAddress = appProperties.getServer_address();
|
String serverAddress = appProperties.getServer_address();
|
||||||
if (!Strings.isNullOrEmpty(serverAddress)) {
|
if (!Strings.isNullOrEmpty(serverAddress)) {
|
||||||
setServerAddressStrategy(new HardcodedServerAddressStrategy(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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ spring:
|
|||||||
|
|
||||||
hapi:
|
hapi:
|
||||||
fhir:
|
fhir:
|
||||||
|
### enable to use the ApacheProxyAddressStrategy which uses X-Forwarded-* headers
|
||||||
|
### to determine the FHIR server address
|
||||||
|
# use_apache_address_strategy: false
|
||||||
|
# use_apache_address_strategy_https: false
|
||||||
### enable to set the Server URL
|
### enable to set the Server URL
|
||||||
# server_address: http://hapi.fhir.org/baseR4
|
# server_address: http://hapi.fhir.org/baseR4
|
||||||
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
|
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
|
||||||
|
|||||||
Reference in New Issue
Block a user