Skip to content

Commit

Permalink
nginx: add Content-Security-Policy-Report-Only header to all non-word…
Browse files Browse the repository at this point in the history
…press content sites (#57)

Fixes gh-54
  • Loading branch information
timmywil authored Aug 24, 2024
1 parent ad87bbe commit 83d3101
Show file tree
Hide file tree
Showing 3 changed files with 9 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 @@ -13,6 +13,9 @@ server {

server_tokens 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 / {
root /srv/www/content.jquery.com;

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 @@ -12,6 +12,9 @@ server {
error_log /var/log/nginx/error.log crit;
server_tokens 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 / {
proxy_pass http://localhost:<%= @backend_port %>;
proxy_redirect off;
Expand Down
3 changes: 3 additions & 0 deletions modules/profile/templates/miscweb/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ server {

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

# 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/";

<%- if @site['allow_php'] -%>
index index.php index.html;
try_files $uri $uri/ /index.php$is_args$args;
Expand Down

0 comments on commit 83d3101

Please sign in to comment.