Cross Origin Request Blocked: The Same Origin Policy disallows reading the remote resource(Access Control Allow Origin doens not match '(null)')
<p>Angular 2.0 application is trying to interact with Rest Server, getting below CORS issue
<a href="https://i.stack.imgur.com/pVhMf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pVhMf.png" alt="enter image description here"></a></p>

<p>Below is my CORSFilter implementation</p>

<pre><code>response.setHeader("Access-Control-Allow-Origin", "http://localhost:3000");
        response.setHeader("Access-Control-Allow-Methods", request.getMethod());
        response.setHeader("Access-Control-Allow-Credentials", "true");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers"));

        if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
            response.setStatus(HttpServletResponse.SC_OK);
        } else {
            chain.doFilter(req, res);
        }
</code></pre>

<p>Surprisingly same war file if i deploy in local(client is on 3000 port and server is on 8080) it is working fine, in local am not getting <strong>access-control-allow-credentials</strong> and <strong>access-control-expose-headers</strong>, where as in if we deploy it in Server am getting those headers and CORS issue is coming. </p>

<p>UPDATE: we deployed in different server which is http:// application is working fine, where as it is throwing error on https://</p>