Closed whitter closed 1 month ago
Hi @whitter
Thanks for the report, though I am not sure if removing the cache would fix your issue here. I think only the output of the scripts are cached, not the whole view. So if you are overwriting the HeadBottom.cshtml
your code shouldn't be cached.
But those are just my initial thoughts, I'll try to reproduce this myself and see if I can find a fix for it :)
Hi @patrickdemooij9,
Just calling in to see if you had a chance to reproduce the above and see if you need anymore information.
Hi @whitter Sorry for the late reply, been quite busy with the Umbraco 14 version. I was able to reproduce this issue and it was indeed caused by the caching. I've added a new property to disable the caching for the rendering, which should fix your issue. I am hoping to get this released with a new version in the coming weeks.
Thank you for the report!
The current caching of the Script Manager view output is causing issues when mixed with CSP Manager.
So for instance when wanting to apply CSP nonce for Google Tag Manger we would create a custom view to override the default GTM
HeadBottom.cshtml
view from Script Manager to added the extra bit of JS to configure the nonce.When using CSP Manager this nonce creation is handled with a tag helper so when end up with a view template like this:
CSP Manager will then keep track of the creation of nonce on the
HttpContext
and its middleware will output the CSP response headers based on the state of the data in the context. With the caching of the view output in Script Manager, subsequent request do not create the context data that CSP Manager expects and no nonce is output in the CSP header.Based on my understanding of the Script Manager code the caching could be removed (or toggled on/off with a setting) with no detrimental affect.