title: Apache Tomcat No 'Access-Control-Allow-Origin' header is present on the requested resource
body: <p>I am getting the following CORS message:</p>
  
  <pre><code>Access to XMLHttpRequest at 'http://localhost:8080/ottoautomaatitv2/webservice?postitoimipaikka=mikkeli' 
  from origin 'http://localhost:4200' has been blocked by CORS policy: 
  No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p>What I have done to try to fix the issue is to add a <a href="https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html" rel="nofollow noreferrer">CORS filter</a>, but that didn't solve the issue.</p>
  
  <pre><code>&lt;filter&gt;
    &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
    &lt;filter-class&gt;org.apache.catalina.filters.CorsFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
    &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>The only way I can get around the issue is by using Google Chrome with a <code>--user-data-dir="C:/Chrome dev session" --disable-web-security</code> target, but this is not ideal for me. How do I enable <code>Access-Control-Allow-Origin</code> on Apache Tomcat?</p>