1

I have enabled mod_headers in my apache (2.2 on windows server 2008) config but it is not doing anything.

I have moved the headers directive to all parts of the config and even to a .htaccess file in the root and still it does nothing.

<VirtualHost *:80>

    ServerName [dedacted]
    ServerAdmin [dedacted]
    DocumentRoot "C:\data"

    Header always append Access-Control-Allow-Origin "*"

    ErrorLog "logs/data.log"
    CustomLog "logs/data.log" common

    <Directory C:\data>
        Options FollowSymLinks All
        AllowOverride All
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

I have checked the module is loaded via the command line and phpinfo(), see below:

Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env **mod_headers** mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_rewrite mod_setenvif mod_php5 

Im going out of my mind, and even getting to the point where im considering reinstalling apache.

Can anyone help!

2 Answers 2

1

Any chance you're doing this for the same reason the rest of us are doing this now, custom font files? If so, here's what I wound up doing, might help:

<FilesMatch "\.(ttf|otf|eot)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>
1
  • No its for a different purpose, but it applies to font files and any other resource requested from a domain that did not originally serve the initial request.
    – James
    Commented Mar 30, 2011 at 15:23
0

I think the Header directive should go inside a <Directory>, <File> or <Location> section. Like so:

<Directory C:\data>
    Options FollowSymLinks All
    AllowOverride All
    Order deny,allow
    Allow from all
    Header always append Access-Control-Allow-Origin "*"
</Directory>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .