title: Apache CORS OPTIONS request status 501 error
body: <h1>Angular 2 http post not setting content type</h1>
  <p>Im trying to set headers on http.post with no luck.</p>
  <pre><code>import { Injectable } from '@angular/core';
  import { Http, Headers, RequestOptions, Response } from '@angular/http';
  
  import { User } from '../_models/index';
  
  @Injectable()
  export class UserService {
  constructor(private http: Http) { }
  
  create(username: string, firstname: string, lastname: string, email: string, password: string) {
      let headers = new Headers({
          'Accept' : 'application/json',
          'Content-Type': 'application/json'
      });
      let options = new RequestOptions({ headers: headers, method: 'post' });
  
      return this.http.post(
          'http://127.0.0.1:8080/api/users/register',
          JSON.stringify({username, firstname, lastname, email, password}),
          options
          // this.jwt()
      ).map(
          (response: Response) =&gt; response.json()
      );
  }
  </code></pre>
  <p>I've set headers on my apache config</p>
  <pre><code>    &lt;Directory /var/www/stockwatch_api&gt;
              Header set Access-Control-Allow-Origin &quot;*&quot;
              Header set Access-Control-Allow-Headers &quot;Content-Type&quot;
              Header set Access-Control-Allow-Methods &quot;POST, PUT, DELETE, GET, HEAD&quot;
  </code></pre>
  <p>I've also set the same headers in my cakephp api app.</p>
  <p>I'm getting this response:</p>
  <blockquote>
  <p>Status Code: 501 Not Implemented</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/NfZ4X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NfZ4X.png" alt="enter image description here" /></a></p>