title: Angular 5 / Apache / No 'Access-Control-Allow-Origin' header
body: <p>I'm working on with an apache2 / silex api with an angular 5 front.
  I've no problem with my get requests, it's working fine, however, i can't troubleshoot my issue with POST, PUT or DELETE requests, i keep getting this error => </p>
  
  <blockquote>
    <p>Response to preflight request doesn't pass access control check: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>I searched thoroughly, and i think i do understand the cors concept, here's my .htaccess =></p>
  
  <pre><code>DirectoryIndex bootstrap.php
  &lt;Limit GET POST PUT DELETE OPTIONS&gt;
    Allow from all
  &lt;/Limit&gt;
  
  Header set Access-Control-Allow-Origin "*"
  RewriteCond %{REQUEST_METHOD} OPTIONS
  RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]]
  #Header set Access-Control-Allow-Origin "*"
  Header always set Access-Control-Allow-Credentials "true"
  Header always set Access-Control-Max-Age "1000"
  Header always set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"
  Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
  </code></pre>
  
  <p>When i look up at my request tab in my chrome browser, i do see moreover that my options preflight request has "200 OK" status code and the response headers are those ones =></p>
  
  <pre><code>Access-Control-Allow-Credentials:true
  Access-Control-Allow-Headers:X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding
  Access-Control-Allow-Methods:POST, GET, OPTIONS, DELETE, PUT
  Access-Control-Max-Age:1000
  Connection:Keep-Alive
  Content-Length:574
  Content-Type:text/html; charset=iso-8859-1
  Date:Sun, 26 Nov 2017 10:18:21 GMT
  Keep-Alive:timeout=5, max=100
  Server:Apache/2.4.25 (Debian)
  </code></pre>
  
  <p>I then do understand that the problem is that the "Access-Control-Allow-Origin" header is missing in case of options preflight ( although this header is here with a get request,...</p>
  
  <p>So my question is => is it possible, with .htaccess to answer to an option preflight automatically with the 'Access-Control-Allow-Origin' header AND a 200 status and if so how ?</p>
  
  <p>Any help would be much appreciated :)</p>
  
  <p>PS: English being not my mother tongue, please excuse any errors,...</p>