nella sezione env: del mio file yml per una configurazione multisito abbastanza standard, tutti gli URL CDN vengono rifiutati dal browser a causa di un errore CSP.
content security policy script src afferma “Ulteriori origini script consentite. L’host corrente e il CDN sono inclusi per impostazione predefinita. Vedi Mitigare gli attacchi XSS con la Content Security Policy.”, ma quando lo definisco (o lo aggiungo/rimuovo da discourse.conf e riavvio sv restart unicorn), ottengo questo:
anche con content security policy report only impostato su true, il sito non si carica comunque.
Sembra necessario disattivare content_security_policy o aggiungere l’URL del CDN a content security policy script src affinché il browser carichi le risorse.
CDN URLs should be computed and included in the CSP by default. Could you also provide (or try comparing) the actual CSP served in the header and the source of the blocked assets?
And here is the URL for one of the assets that won’t load: https://lcsupport-92e2.kxcdn.com/brotli_asset/preload-store-d32dcf974dddcac742f8a7a6aa7fcd686185920b201029d0ecb2b85527ef9034.js
https://abedmulti-92e2.kxcdn.com/uploads/assets/
https://abedmulti-92e2.kxcdn.com/uploads/brotli_asset/
# i.e. DISCOURSE_S3_CDN_URL + /brotli_asset/
But the actual address is
https://lcsupport-92e2.kxcdn.com/brotli_asset/preload-store-d32dcf974dddcac742f8a7a6aa7fcd686185920b201029d0ecb2b85527ef9034.js
# i.e. DISCOURSE_CDN_URL + /brotli_asset/...
The relevant CSP code:
We prioritize using DISCOURSE_S3_CDN_URL for assets when available. This aligns with the CDN asset URL generation.
@pfaffman Does GlobalSetting.use_s3? return true for your site?
I wonder if we need an additional GlobalSetting.use_s3? check here. Does having GlobalSetting.s3_cdn_url necessarily imply GlobalSetting.use_s3?? I’m a bit hazy with asset genereation / S3 CDN now could someone more familiar with it also take a look? Thanks!