hyperia-sk/yii2-secure-headers

how to use smartloop config using this library ?

Closed this issue · 1 comments

First of all thank you so much for create such a useful extension .
I have integrated smartsupp chat script which required me to enable below options in one of our website. Link

Could you please let me know what config I need to set to enable this ?

Content-Security-Policy: default-src 'self'; script-src 'self' https://*.smartlook.com https://*.smartlook.cloud 'nonce-randomlyGeneratedBase64Nonce' 'unsafe-eval'; connect-src 'self' https://*.smartlook.com https://*.smartlook.cloud; worker-src 'self' blob:

<script nonce="randomlyGeneratedBase64Nonce">...Your Smartlook Tracking Script...</script>

Hi,

we are happy that you like our extension :)
If you want to enable this integration try this config:

'components' => [
      ...
      'headers' => [
            'class' => '\hyperia\security\Headers',
            
            ...

            'cspDirectives' => [
                  'default-src' => "'self'"
                  'connect-src' => "'self' https://*.smartlook.com https://*.smartlook.cloud",
                  'script-src' => "'self' https://*.smartlook.com https://*.smartlook.cloud 'nonce-randomlyGeneratedBase64Nonce' 'unsafe-eval'",
                  'worker-src' => "'self' blob:",
            ],

            ...
      ]
]