title: No ‘Access-Control-Allow-Origin’ header is present on the requested resource
body: <p>I'm working on an API Rest with Symfony and React as a frontend "framework".</p>
  
  <p>When trying to connect to an URL with Postman for a GET request such as <a href="http://example.com/api/headers" rel="nofollow noreferrer">http://example.com/api/headers</a> it works perfectly. But when I try to connect with React App <a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>, I receive this error message: "localhost/:1 Access to XMLHttpRequest at ’<a href="http://example.com/api/headers" rel="nofollow noreferrer">http://example.com/api/headers</a>' from origin ‘<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.".</p>
  
  <p>I specify that I'm using MongoDB ODM instead of ORM.</p>
  
  <p>So it seems that everything should be managed with NelmioCorsBundle (<a href="https://github.com/nelmio/NelmioCorsBundle" rel="nofollow noreferrer">https://github.com/nelmio/NelmioCorsBundle</a>).</p>
  
  <p>I've installed the Bundle, done all the things I had to do according to the documentation. I tried different configurations in config/nelmio_cors.yaml I found on forums. 
  I've also found this Github issue (<a href="https://github.com/nelmio/NelmioCorsBundle/issues/68" rel="nofollow noreferrer">https://github.com/nelmio/NelmioCorsBundle/issues/68</a>) explaining that the problem could be solved by clearing cache. So I tried php bin/console clear:cache (on both dev + prod environments) but it hasn't changed anything.</p>
  
  <p>This is my current nelmio_cors.yaml file:</p>
  
  <pre><code>nelmio_cors:
      defaults:
          allow_credentials: true
          origin_regex: true
          allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
          allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
          allow_headers: ['Content-Type', 'Authorization']
          max_age: 3600
      paths:
          '^/api/': ~
  </code></pre>
  
  <p>And this is my .env file:</p>
  
  <pre><code>CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$
  </code></pre>
  
  <p>I can see that I can't modify request headers but only response headers and according to the error message, I should be able to add ‘Access-Control-Allow-Origin’ in request headers and I don't know how. </p>
  
  <p>Thanks a lot!</p>