CORS in Apache2

·
1 min read
web linux tutorial
#apache2 #site #cors

Complete guide to enabling Cross-Origin Resource Sharing (CORS) in Apache2 web server for handling cross-domain requests and API access.

Browser keep stricter each days. Now, they insist on CORS. I can’t enable it in .htaccess, must do it in sites-enabled.

<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>

Further Read

Access-Control-Allow-Origin Multiple Origin Domains?