I am running a self-hosted Nextcloud installation on Apache behind HAproxy.
I encountered an error with the fonts, similar to what is described in this forum post. As a remedy, it is suggested to alter the Content-Security-Policy
like so:
<IfModule mod_headers.c>
Header set Content-Security-Policy: "font-src https: data:;"
# `mod_headers` cannot match based on the content-type, however,
# the `Content-Security-Policy` response header should be send
# only for HTML documents and not for the other resources.
<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>
However, this has an effect I cannot explain. If I access Nextcloud through Firefox/Chrome, there are two Content-Security-Policy
headers:
This causes the 'Content-Security-Policy: font-src https: data:;' header to be ignored as it is less restrictive, from my understanding. The issue I encounter persists.
However, if I access Nextcloud through IE, I see a single header:
Content-Security-Policy: font-src https: data:;, default-src 'self'; script-src * 'unsafe-inline'
'unsafe-eval'; style-src * 'unsafe-inline'; img-src * 'unsafe-inline' data:; font-src *;
object-src 'self';media-src 'self'; frame-src 'self';
In this case, the issue is resolved and fonts are loaded.
What could be causing a second header to appear in Chrome/Firefox? How can I resolve this issue?