title: Enable CORS Apache Tomcat 7.0.52
body: <p>I have been trying to enable CORS on my Microsoft Azure Apache Tomcat server and I have tried quite a lot of techniques but I am still unable to get CORS up and running. I have added this to the web.xml file and no luck in getting that enabled. </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;init-param&gt;
      &lt;param-name&gt;cors.allowed.origins&lt;/param-name&gt;
      &lt;param-value&gt;*&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;init-param&gt;
      &lt;param-name&gt;cors.allowed.methods&lt;/param-name&gt;
      &lt;param-value&gt;GET,POST,HEAD,OPTIONS,PUT&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;init-param&gt;
      &lt;param-name&gt;cors.allowed.headers&lt;/param-name&gt;
      &lt;param-value&gt;Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;init-param&gt;
      &lt;param-name&gt;cors.exposed.headers&lt;/param-name&gt;
      &lt;param-value&gt;Access-Control-Allow-Origin,Access-Control-Allow-Credentials&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;init-param&gt;
      &lt;param-name&gt;cors.support.credentials&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;init-param&gt;
      &lt;param-name&gt;cors.preflight.maxage&lt;/param-name&gt;
      &lt;param-value&gt;10&lt;/param-value&gt;
    &lt;/init-param&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>I keep getting an error: </p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load url&amp;output=json. No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://url.net" rel="nofollow">http://url.net</a>' is therefore not allowed access.</p>
  </blockquote>
  
  <p>Any suggestions on how I can achieve this quickly? I have been looking at loads of resources online and I can't get it to work unfortunately. Looking forward to your suggestions.</p>