So I have read through the other threads regarding this and have not found a solution.
The problem Im having is because im setting "access-control-allow-methods" "true" I cant use setHeader("Access-Control-Allow-Origin", "*");
I need to set two specific domains...any help is appreciated.
More than one Access-Control-Allow-Origin header was sent by the server. This isn't allowed.
1.1. Access-Control-Allow-Origin : specifies the authorized domains to make cross-domain request. Use “*” as value if there is no restrictions. Access-Control-Allow-Credentials : specifies if cross-domain requests can have authorization credentials or not.
Limiting the possible Access-Control-Allow-Origin values to a set of allowed origins requires code on the server side to check the value of the Origin request header, compare that to a list of allowed origins, and then if the Origin value is in the list, set the Access-Control-Allow-Origin value to the same value as ...
public class CorsInterceptor implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
//When we send the http-only cookie the 'Access-Control-Allow-Origin' header cannot be *
responseContext.getHeaders().putSingle("Access-Control-Allow-Origin", requestContext.getHeaderString("origin"));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With