helmet.js

CSP error while serving with express (with helmet) an app created with create-react-app

笑着哭i 提交于 2021-02-05 08:24:12
问题 I'm struggling with serving a build created with "create-react-app" using Express with Helmet. I'm getting several errors in the explorer console related to Content Security Policy: csp-errors Of course, it isn't showing the app. I noticed that if a remove Helmet as middleware in Express it works but that's not the solution I want. This is my server code: const express = require('express'); const helmet = require('helmet'); const cors = require('cors'); const morgan = require('morgan'); const

Can React Helmet inject a javascript object into <HEAD> tag?

六眼飞鱼酱① 提交于 2021-01-02 05:20:24
问题 I've a question, I need to inject into the HEAD tag a javascript object, for tag management purposes. This is my Helmet component, but it accepts only specific parameters to set to metadata serverside through rewind() function. Is there a way still to use React Helmet to do what I need, so, create javascritpt objects into a SCRIPT tag or should I follow a different approach? MyComponent.js <Helmet title={article.get('title')} meta={[ {"property": "og:title", "content": article.get('title')},

Helmet CSP not working correctly?

自闭症网瘾萝莉.ら 提交于 2020-12-07 03:41:59
问题 Using Vue SPA distributed by Express. this is my helmet code in express app.use(helmet.contentSecurityPolicy({ directives: { defaultSrc: ["'self'"], styleSrc: ["'self'","'unsafe-inline'" ,'unpkg.com', 'cdn.jsdelivr.net', 'fonts.googleapis.com', 'use.fontawesome.com'], scriptSrc: ["'self'","'unsafe-inline'",'js.stripe.com'], frameSrc: ["'self'",'js.stripe.com'], fontSrc:["'self'",'fonts.googleapis.com','fonts.gstatic.com','use.fontawesome.com','cdn. joinhoney.com'] } })); Doing this produces

nodeJS https - unable to set Content-Security-Policy

半腔热情 提交于 2019-12-11 17:55:55
问题 I am trying to write a simple NodeJS HTTPS web server using HTTPS and Express that has a configurable Content-Security-Policy. I try to set the Content-Security-Policy header attribute in the server response object, but always just sends "default-src 'self'". it appears that the HTTPS module overwrites whatever I specify. I have also tried using the helmet-csp npm package with no success either. Here's my code snippet: var app = express(); var sslOptions = { cert: fs.readFileSync(ourPath + "