Skip to content

Commit ff6eb03

Browse files
committed
fix: allow custom styles in CSP
1 parent e4e5ead commit ff6eb03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

templates/common.filter.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Allow load ab2p resources from sites with CSP policies applied
22
SERVER-HEADER-FILTER: allow-custom-css "Add ${NGINX_SERVER_NAME} to style-src in CSP"
3-
s/^Content-Security-Policy:\s*(.*)/Content-Security-Policy: $1; style-src https:\/\/${NGINX_SERVER_NAME}/i
3+
s/(style-src\s+)([^;]*)(;)/$1$2 ${NGINX_SERVER_NAME}$3/gmi
4+
s/^Content-Security-Policy:\s+(?!.*style-src)(.*)$/Content-Security-Policy: $1; style-src ${NGINX_SERVER_NAME}/mi

0 commit comments

Comments
 (0)