Hi Blessed,
Thanks for the pointer, I looked into the thread but not sure about it. Seems to me the other author get the problem solved using Filter approach. Mine is run as SpringBoot Application and thus using interceptor.
CorsConfiguration config = new CorsConfiguration();
config.addAllowedHeader("x-fhir-starter");
config.addAllowedHeader("Origin");
config.addAllowedHeader("Accept");
config.addAllowedHeader("X-Requested-With");
config.addAllowedHeader("Content-Type");
config.addAllowedOrigin("*");
config.addExposedHeader("Location");
config.addExposedHeader("Content-Location");
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
CorsInterceptor interceptor = new CorsInterceptor(config);
fhirServer.registerInterceptor(interceptor);
Now if I call a GET with Origin from Postman, the response header returns as below …
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Access-Control-Expose-Headers: Location, Content-Location
Access-Control-Allow-Credentials: true
X-Powered-By: HAPI FHIR 6.2.2 REST Server (FHIR Server; FHIR 4.0.1/R4)
X-Request-ID: j4U8KmYCgWWskft3
But on a Javascript pre-flight call from browser, it fails.
thanks
Ki Nam Choi