title: CORS issue on accessing API with JWT token
body: <p>I am facing a CORS issue when accessing Symfony REST API from angular with JWT token.</p>
  
  <p>IIS server has been configured to access the application with domain name and IP address. The Front end code is in the same directory of Symfony.</p>
  
  <p>Front end calls API with domain name. Accessing application from IP addresss with JWT token gives CORS issue since API is pointing to domain name.</p>
  
  <p>I have set up response headers with below options in kernel listener.</p>
  
  <p>I am using lexik/jwt-authentication-bundle to generating token(s)</p>
  
  <pre><code>$responseHeaders-&gt;set('Access-Control-Allow-Headers', 'origin, content-type, accept,authorization');
  $responseHeaders-&gt;set('Access-Control-Allow-Origin', '*');
  $responseHeaders-&gt;set('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, PATCH, OPTIONS');
  $responseHeaders-&gt;set('Access-Control-Allow-Credentials', true);
  </code></pre>
  
  <p>I have also set up Nelmio CORS bundle with below options</p>
  
  <pre><code>enter code hernelmio_cors:
      defaults:
          allow_credentials: false
          allow_origin: []
          allow_headers: []
          allow_methods: []
          expose_headers: []
          max_age: 0
          hosts: []
          origin_regex: false
          forced_allow_origin_value: ~        
      paths:
          '^/api/':
              allow_origin: ['*']
              allow_headers: ['*']
              allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
              max_age: 3600
          '^/':
              allow_origin: ['*']
              allow_headers: ['*']
              allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
              max_age: 3600e
  </code></pre>
  
  <p>Response Header:</p>
  
  <p>allow<br>
  OPTIONS, TRACE, GET, HEAD, POST
  content-length<br>
  0
  date<br>
  Mon, 13 Nov 2017 16:03:22 GMT
  public<br>
  OPTIONS, TRACE, GET, HEAD, POST
  server<br>
  Microsoft-IIS/10.0
  X-Firefox-Spdy<br>
  h2</p>
  
  <p>Thanks in Advance!</p>