title: Ionic service worker send OPTIONS for GET
body: <p>I'm currently working with Ionic to get data from an API. Although it's been working for the last days, I don't know how it stopped working.</p>
  
  <p>I am using <code>@angular/http</code> to make my requests. When not using any headers, my request goes to <code>GET</code> Method, and doesn't work because I need an Authorization token.</p>
  
  <p>But, if I had Headers via:</p>
  
  <pre><code>let headers = new Headers();
  headers.append('Authorization', this.bearerToken);            
  let options = new RequestOptions({ headers: headers });
  </code></pre>
  
  <p>It doesn't work either. The request goes to <code>OPTIONS</code> Method, and is returning:</p>
  
  <pre><code>Unauthorized header authorization
  </code></pre>
  
  <p>Is there anything I can do on Ionic to fix this, or should I warn the API developers in order to make them do some changes?</p>
  
  <p>Edit: The API developers are using Symfony and Nelmio CORS Bundle to handle these settings</p>
  
  <pre><code>nelmio_cors:
     defaults:
         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:
         '^/': ~
  </code></pre>
  
  <p>As @Moshe mentionned, their configuration should contain some <code>Access-Control-Allow-Headers</code>, and they do apparently..</p>