title: How to enable 'Access-Control-Allow-Origin' header for all files in a directory of XAMPP?
body: <p>I am developing a HTML5 Javascript app to get an image from my local server which runs on the same machine as the app. When I run the app on my Chrome, I got:</p>
  
  <blockquote>
    <p>Access to Image at '<a href="http://localhost/someDIrectory/1.jpg" rel="noreferrer">http://localhost/someDIrectory/1.jpg</a>' from origin
    '<a href="http://localhost:50000" rel="noreferrer">http://localhost:50000</a>' has been blocked by CORS policy: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://localhost:50000" rel="noreferrer">http://localhost:50000</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>From many questions here, the answers point out that I need to set </p>
  
  <blockquote>
    <p>header("Access-Control-Allow-Origin: *");</p>
  </blockquote>
  
  <p>in php file and it should work, but that is for php files... What about an image or a directory with images?</p>
  
  <p>I have also came across <a href="https://stackoverflow.com/questions/34872760/how-do-i-enable-cross-origin-resource-sharing-on-xampp">How do I enable cross-origin resource sharing on XAMPP?</a> and tried to add </p>
  
  <pre><code>&lt;IfModule C:\xampp\htdocs\someDIrectory\1.jpg&gt;
      Header set Access-Control-Allow-Origin: *
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>into httpd.conf. I tried restart XAMPP and retried the above. But the result I got is still the same.</p>
  
  <p>How to correctly set up such setting for XAMPP?</p>
  
  <p>Note: I am using Construct 2 which is basically exported out as an HTML5/Javascript. I am simply using Sprite Load From URL action.</p>