Skip to content

Commit 83d3101

Browse files
authored
nginx: add Content-Security-Policy-Report-Only header to all non-wordpress content sites (#57)
Fixes gh-54
1 parent ad87bbe commit 83d3101

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

modules/profile/templates/contentorigin/site.nginx.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ server {
1313

1414
server_tokens off;
1515

16+
# Add Content Security Policy headers
17+
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' code.jquery.com; connect-src 'self'; img-src 'self'; style-src 'self'; report-to https://csp-report-api.openjs-foundation.workers.dev/";
18+
1619
location / {
1720
root /srv/www/content.jquery.com;
1821

modules/profile/templates/gruntjscom/site.nginx.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ server {
1212
error_log /var/log/nginx/error.log crit;
1313
server_tokens off;
1414

15+
# Add Content Security Policy headers
16+
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' code.jquery.com; connect-src 'self'; img-src 'self'; style-src 'self'; report-to https://csp-report-api.openjs-foundation.workers.dev/";
17+
1518
location / {
1619
proxy_pass http://localhost:<%= @backend_port %>;
1720
proxy_redirect off;

modules/profile/templates/miscweb/site.nginx.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ server {
1818

1919
root /srv/www/<%= @fqdn %><%= @site['webroot'] or '' %>;
2020

21+
# Add Content Security Policy headers
22+
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' code.jquery.com; connect-src 'self'; img-src 'self'; style-src 'self'; report-to https://csp-report-api.openjs-foundation.workers.dev/";
23+
2124
<%- if @site['allow_php'] -%>
2225
index index.php index.html;
2326
try_files $uri $uri/ /index.php$is_args$args;

0 commit comments

Comments
 (0)