Refused to apply inline style because it violates the following Content Security Policy directive: “style-src ‘self’ ‘nonce-Vs0RA4diyTa6WTnfA4Cy3Q=='”. Either the ‘unsafe-inline’ keyword, a hash (‘sha256-DCi8t3r+YRqVUj7mwqQSCiWFl6zZOX7K41Xi0fvwscs=’), or a nonce (‘nonce-…’) is required to enable inline execution
how to resolve this issue
const crypto = require(‘crypto’);
const nonce = crypto.randomBytes(16).toString(‘base64’);
res.header(“Cache-Control”, “must-revalidate”);
res.setHeader(
‘Content-Security-Policy’, default-src 'self'; script-src 'self'; style-src 'self' 'nonce-${nonce}'; font-src 'self'; img-src 'self'; frame-src 'self'
);
currently I am doing this
Harsh Jain is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.