title: How to let the zuul proxy handle the cors?
body: <p>I have several microservices behind a microservice acting as zuul proxy.</p>
  
  <p>When called from outside the domain the microservices return a "403- Invalid Cors".</p>
  
  <p>This is solved by adding the following to <strong><em>each</em></strong> microservice:</p>
  
  <pre><code>@Configuration
  public class CorsConfig extends WebMvcConfigurerAdapter {
  
  @Override
  public void addCorsMappings(CorsRegistry registry) {
      registry.addMapping("/**"); //just for the sake of explaination i'm allowing everything
  }
  }
  </code></pre>
  
  <p>Anyway this is a bad design: I have a zuul api gateway after all! This should be done by that and the microservices should actually return that error when directly called.</p>
  
  <p>So, I moved that same configuration <strong>only to my zuul microservice</strong>, here it is by the way:</p>
  
  <pre><code>@SpringBootApplication
  @EnableSwagger2
  @EnableZuulProxy
  @ComponentScan(basePackages = "my.base.package")
  public class MyApiGateway extends SpringBootServletInitializer {
  
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
      return configureApplication(builder);
  }
    ....
  </code></pre>
  
  <p>The props:</p>
  
  <pre><code>zuul:
   prefix: /api
   routes:
     my-api:
       path: /myApi/**
       url: 'http: ...'
       stripPrefix: true
  </code></pre>
  
  <p>Problem is that the microservice still returns "403 - Invalid Cors"! What am I doing wrong? I guess this happens because the zuul proxy actually does nothing except to forward the request...but how to configure it so to make the destination MS notice that the request comes from zuul, on the same network and so allowing it?</p>