Adding logging related to CORS configuration

Removing unused `allow_placeholder_references` property that causes confusion with `auto_create_placeholder_references`
Improving `.dockerignore` so that it ignores specific target files/directories that are generated by MVN/java, but not the .war file (so that compiled .war files can be easily turned into a docker image)
This commit is contained in:
Sean McIlvenna
2021-05-27 14:07:05 -07:00
parent 9760e586b6
commit a150aeb4d2
5 changed files with 18 additions and 14 deletions

View File

@@ -48,6 +48,7 @@ import java.util.*;
import java.util.stream.Collectors;
public class BaseJpaRestfulServer extends RestfulServer {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseJpaRestfulServer.class);
@Autowired
DaoRegistry daoRegistry;
@@ -270,6 +271,7 @@ public class BaseJpaRestfulServer extends RestfulServer {
// showing a typical setup. You should customize this
// to your specific needs
if (appProperties.getCors() != null) {
ourLog.info("CORS is enabled on this server");
CorsConfiguration config = new CorsConfiguration();
config.addAllowedHeader(HttpHeaders.ORIGIN);
config.addAllowedHeader(HttpHeaders.ACCEPT);
@@ -279,9 +281,10 @@ public class BaseJpaRestfulServer extends RestfulServer {
config.addAllowedHeader("x-fhir-starter");
config.addAllowedHeader("X-Requested-With");
config.addAllowedHeader("Prefer");
List<String> allAllowedCORSOrigins = appProperties.getCors().getAllowed_origin();
allAllowedCORSOrigins.forEach(config::addAllowedOriginPattern);
ourLog.info("CORS allows the following origins: " + String.join(", ", allAllowedCORSOrigins));
config.addExposedHeader("Location");
config.addExposedHeader("Content-Location");
@@ -292,7 +295,9 @@ public class BaseJpaRestfulServer extends RestfulServer {
// Create the interceptor and register it
CorsInterceptor interceptor = new CorsInterceptor(config);
registerInterceptor(interceptor);
}
} else {
ourLog.info("CORS is disabled on this server");
}
// If subscriptions are enabled, we want to register the interceptor that
// will activate them and match results against them