i have a web page that do a POST to another page in other subdomain (subdomain1.domain.com -> subdomain2.domain.com) and i understand that i need configure cors to allow that situation. I did all the configs and it works in CHROME, FIREFOX AND IE11 ..
but there is an exception, only in IE11 ON MY CLIENT NETWORK the request doesnt work returning "origin not found in access-control-allow-origin header"
i find out that it occurs because in my client network the request does not return SECURITY header. The images below can explain it better:
IE11 OUTSIDE MY CLIENT NETWORK (In red the CORS return from server)
IE11 INSIDE MY CLIENT NETWORK (There is no security header return from server)
JAVA CODE SERVER CORS FILTER (There is no security header return from server)
public class CorsFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse resp = (HttpServletResponse) servletResponse;
resp.addHeader("Access-Control-Allow-Origin", "https://intranet2.culturainglesa.net");
resp.addHeader("Access-Control-Allow-Credentials", "true");
resp.addHeader("Access-Control-Allow-Methods", "GET,POST");
resp.addHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
// Just ACCEPT and REPLY OK if OPTIONS
if (request.getMethod().equals("OPTIONS")) {
resp.setStatus(HttpServletResponse.SC_OK);
return;
}
chain.doFilter(request, servletResponse);
}
@Override
public void destroy() {
// TODO Auto-generated method stub
}
}