Created
December 22, 2013 09:47
-
-
Save name-k/8080390 to your computer and use it in GitHub Desktop.
Allow Cross-Domain Images with CORS
Images are usually cool to serve from a different domain but if you want access to their data with canvas, you're in trouble. This snippet allows you to get raw image data via canvas:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_setenvif.c> | |
<IfModule mod_headers.c> | |
<FilesMatch "\.(cur|gif|ico|jpe?g|png|svgz?|webp)$"> | |
SetEnvIf Origin ":" IS_CORS | |
Header set Access-Control-Allow-Origin "*" env=IS_CORS | |
</FilesMatch> | |
</IfModule> | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment