I have been trying to set a text editor in my web app. Where to access the text editor I have to allow script-src 'self' 'unsafe-inline' 'unsafe-eval' and style-src 'unsafe-inline'. But in playframework 2.6.x i have to set this by
play.filters.headers.contentSecurityPolicy in config file which makes the whole app insecure.
Note: meta tag does not work, even I tried to pass Content-security-policy in response header by filter. Nothing works.
In this case is there any way of setting script-src 'self' 'unsafe-inline' 'unsafe-eval' and style-src 'unsafe-inline' for any specific page or path in play 2.6.x?
Here is an example from the Silhouette Seed Template
Play 2.7 On a certain Action it looks like:
Check the documentation: https://www.playframework.com/documentation/2.7.x/SecurityHeaders#Action-specific-overrides
However in Play 2.7 this is deprecated - use CSP instead - see: https://www.playframework.com/documentation/2.7.x/CspFilter#Enabling-CSP-on-Specific-Actions
There is also a possibility (on the same doc) to exclude a
routefrom the CSP filter, like: