title: apache2 mod_headers not working
body: <p><strong>Question Description:</strong> I want to set my site "Access-Control-Allow-Origin", so I set it in apache's config (almost anywhere), but it's not working. I also set other headers for testing, but it's still not working too.</p>
  
  <p><strong>Apache version:</strong> 2.2.22</p>
  
  <p><strong>Apache modules:</strong> <a href="http://www.anwcl.com/test/show_modules.php">http://www.anwcl.com/test/show_modules.php</a></p>
  
  <p><strong>My target url:</strong></p>
  
  <pre><code>http://www.anwcl.com/test/test_only_div.html
  </code></pre>
  
  <p><strong>And it's linked to my local file:</strong></p>
  
  <pre><code>e:\wamp\www\test\test_only_div.html
  </code></pre>
  
  <hr>
  
  <h2><strong>And here's my apache's configurations:</strong></h2>
  
  <p><strong>E:\wamp\bin\apache\apache2.2.22\conf\httpd.conf</strong></p>
  
  <pre><code>...
  LoadModule headers_module modules/mod_headers.so
  ...
  Include conf/extra/httpd-vhosts.conf
  ...
  </code></pre>
  
  <p><strong>E:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhosts.conf</strong></p>
  
  <pre><code>NameVirtualHost *:80
  &lt;VirtualHost *:80&gt;
      Header add Access-Control-Allow-Origin "*"
      Header echo ^TS
      Header add MyHeader "Hello Joe. It took %D microseconds for Apache to serve this request."
      ServerAdmin xxx@gmail.com
      DocumentRoot "E:/wamp/www/"
      ServerName www.anwcl.com
      ErrorLog "logs/xxx.log"
      CustomLog "logs/xxx.log" common
      &lt;Directory "E:/wamp/www/"&gt;
          Header add Access-Control-Allow-Origin "*"
          Options Indexes FollowSymLinks
          AllowOverride All
          Order allow,deny
          Allow from all
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p><strong>E:\wamp\www\.htaccess</strong></p>
  
  <pre><code>Header add Access-Control-Allow-Origin "*"
  Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
  Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
  </code></pre>
  
  <p><strong>E:\wamp\www\test\.htaccess</strong></p>
  
  <pre><code>Header add Access-Control-Allow-Origin "*"
  Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
  Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
  </code></pre>
  
  <hr>
  
  <h2><strong>And here's Wireshark's caps, there are no expected headers :</strong></h2>
  
  <pre><code>http://www.anwcl.com/question/apache-mod-headers-not-working.jpg
  http://www.anwcl.com/question/apache-mod-headers-not-working-304.jpg
  </code></pre>