Skip to content

Instantly share code, notes, and snippets.

@moudy
Created January 29, 2014 12:54
Show Gist options
  • Save moudy/8687306 to your computer and use it in GitHub Desktop.
Save moudy/8687306 to your computer and use it in GitHub Desktop.
<FilesMatch "\.(eot|woff|svg|ttf)$">
RewriteEngine On
# Let proxy servers with empty referer through
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:FORWARDED-FOR} !^$ [OR]
RewriteCond %{HTTP:X-FORWARDED} !^$ [OR]
RewriteCond %{HTTP:X-FORWARDED-FOR} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule .* - [PT,L]
# For everybody else, the referer must match the domains for which this
# web-font is licensed.
RewriteCond %{HTTP_REFERER} !:\/\/myapp.herokuapp.com/
RewriteRule .* - [F]
# Set Cache-Control header to must-revalidate, as we want clients to check
# against the above rules on each request.
Header set Cache-Control "must-revalidate"
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment