title: Angular setting HTTP request origin as null
body: <p>For a while, I was trying to to get my local angular build to serve with HTTPS (to learn, and to be sure I wasn't going to run into any SSL issues with the final app). However, after no success, I went back to using <code>ng serve</code>, however, all my AJAX requests are failing now. I run a local VM serving a Slim API, and have CORS setup. However, I started seeing the following error:</p>
  
  <pre><code>The 'Access-Control-Allow-Origin' header has a value 'http://gamersplane.local' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.
  </code></pre>
  
  <p>Looking at the call in the network tab, I see that the origin header is indeed null, and looking through my code, I don't mess with the origin header (not sure if you can?). I do set an <code>Authorization</code> header, but that's it? Here's my API service:</p>
  
  <pre><code>private addToken(headers: HttpHeaders) {
      let token = localStorage.getItem('token');
      if (token) {
          headers = headers.set('Authorization', 'Bearer ' + token);
      }
      return headers;
  }
  
  private constructParams(data?: Object) {
      // Object.keys(data).reduce((params, key) =&gt; params.set(key, data[key]), new HttpParams());
      let params = new HttpParams();
      for (let key in data) {
          if (typeof data[key] !== 'object') {
              params = params.set(key, data[key]);
          } else {
              for (let oKey in data[key]) {
                  params = params.set(key + '[' + oKey + ']', data[key][oKey]);
              }
          }
      }
  
      return params;
  }
  
  
  get&lt;T = any&gt;(path: string, data?: Object): Observable&lt;T&gt; {
      let headers = new HttpHeaders();
      headers = this.addToken(headers);
      return this.http
          .get&lt;T&gt;(environment.apiDomain + path, {
              headers: headers,
              params: this.constructParams(data)
          });
  }
  </code></pre>
  
  <p>Any advice?</p>