Last active
April 18, 2017 15:00
-
-
Save wkhayrattee/b7ca50a80409dceb05be6de3332b4ee7 to your computer and use it in GitHub Desktop.
APACHE to NGINX | content-security-policy.conf
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
# 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 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
Seems you want to use something like this module : https://github.com/openresty/headers-more-nginx-module#installation . Some information obtained via http://stackoverflow.com/questions/10053119/how-can-remove-nginx-from-http-response-header .