title: Spring Cloud - Zuul Proxy is producing a No 'Access-Control-Allow-Origin' ajax response
body: <p>Startup Appplication:</p>
  
  <pre><code>@SpringBootApplication
  @EnableZuulProxy
  public class ZuulServer {
  
       public static void main(String[] args) {
           new SpringApplicationBuilder(ZuulServer.class).web(true).run(args);
       }
   }
  </code></pre>
  
  <p>My YAML file is like this:</p>
  
  <pre><code>server:
     port:8080
  
  spring:
     application:
        name: zuul
  
  eureka:
  client:
    enabled: true
      serviceUrl:
         defaultZone: http://localhost:8761/eureka/
  
  
  
  zuul:
      proxy:
         route:
           springapp: /springapp
  </code></pre>
  
  <p>I have a microservice application (on port 8081) called springapp and has some rest services. Below is my client UI app:</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;TODO supply a title&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;script type="text/javascript" src="js/libs/jquery/jquery.min.js" &gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;script type="text/javascript"&gt;
              $.ajax({
                  url: 'http://localhost:8080/zuul/springapp/departments',
                  type: 'GET'
              }).done(function (data) {
                  consoe.log(data);
                  document.write(data);
              });
          &lt;/script&gt;        
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But I get a </p>
  
  <pre><code>XMLHttpRequest cannot load http://localhost:8080/zuul/springapp/departments. No
      'Access-Control-Allow-Origin' header is present on the requested
      resource. Origin 'http://localhost:8383' is therefore not allowed access.
  </code></pre>
  
  <p>This UI  HTML5  app is on <a href="http://localhost:8383/SimpleAPp/index.html" rel="noreferrer">http://localhost:8383/SimpleAPp/index.html</a>. CORS, CORS, CORS... Please help. BTW the <a href="http://localhost:8080/zuul/springapp/departments" rel="noreferrer">http://localhost:8080/zuul/springapp/departments</a> returns a json list as supposed to when on the browser address bar. The spring.io blog <a href="http://spring.io/blog/2015/01/28/the-api-gateway-pattern-angular-js-and-spring-security-part-iv" rel="noreferrer">here</a> says that there is no need for a filter because the zuulproxy takes care of that but I don't know why it is not working for me.</p>