Skip to content

Instantly share code, notes, and snippets.

@TomA-R
Created August 13, 2015 05:46
Show Gist options
  • Save TomA-R/aaca4f6c7fb53319d5f1 to your computer and use it in GitHub Desktop.
Save TomA-R/aaca4f6c7fb53319d5f1 to your computer and use it in GitHub Desktop.
# Serve .vtt files with Access-Control-Allow-Origin: * header if referer is the correct domain
<IfModule mod_setenvif.c>
<FilesMatch "\.vtt$">
SetEnvIf Referer "^http(s)?://(.+\.)?somedomain\.com/" VALID_REFERER=$1
Header set Access-Control-Allow-Origin "*" env=VALID_REFERER
</FilesMatch>
</IfModule>
You could also use origin
Persisting issue: this doesn't work properly if you're behind ATS/Squid/.. which caches requests without taking headers into account
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment