Skip to content

Commit

Permalink
nginx: add Content-Security-Policy-Report-Only header to all content …
Browse files Browse the repository at this point in the history
…sites

Fixes jquerygh-54
  • Loading branch information
timmywil committed Aug 12, 2024
1 parent 96af93f commit e00a878
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/profile/templates/contentorigin/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ server {
expires 30d;

add_header Access-Control-Allow-Origin "*";

# Add Content Security Policy headers
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/";
}

location /.well-known/acme-challenge {
Expand Down
3 changes: 3 additions & 0 deletions modules/profile/templates/gruntjscom/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ server {
proxy_pass http://localhost:<%= @backend_port %>;
proxy_redirect off;
proxy_buffering off;

# Add Content Security Policy headers
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/";
}

location /.well-known/acme-challenge {
Expand Down
6 changes: 6 additions & 0 deletions modules/profile/templates/miscweb/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ server {
include /etc/nginx/fastcgi_params;
}
<%- end -%>

location / {

# Add Content Security Policy headers
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/";
}
}

# vim: ts=2 sw=2 et
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ server {

location / {
deny all;

# Add Content Security Policy headers
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/";
}
}

0 comments on commit e00a878

Please sign in to comment.