Мой REST API - это сервер нескольких доменов. Как я могу разрешить более одного домена в моих заголовках.
Мой код на Java:
public class CORSFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin","abc.com","xyz.com");
response.setHeader("Cache-Control", "no-store, public, max-age=0");
response.setHeader("Pragma", "no-cache");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Strict-Transport-Security", "max-age=63072000; includeSubDomains;");
chain.doFilter(req, res);
}
}