Forked from wkhayrattee/APACHE_content-security-policy.conf
Created
April 18, 2017 15:00
-
-
Save harikt/b276124fd7c5e508d22de74a0bfc7ac6 to your computer and use it in GitHub Desktop.
APACHE to NGINX | content-security-policy.conf
This file contains hidden or 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
# REF: https://github.com/h5bp/server-configs-apache/blob/master/src/security/content-security-policy.conf | |
<IfModule mod_headers.c> | |
Header set Content-Security-Policy "script-src 'self'; object-src 'self'" | |
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$"> | |
Header unset Content-Security-Policy | |
</FilesMatch> | |
</IfModule> |
This file contains hidden or 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
# by default add some general content-security-policy | |
add_header Content-Security-Policy "object-src 'self'; script-src 'self'; report-uri 'https://a64f09869d9d888886f95be0f597d7ec.report-uri.io/r/default/csp/enforce' "; | |
# now unset Content-Security-Policy for resources matching all below | |
location ~* \.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$ { | |
more_clear_headers 'Content-Security-Policy'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment