Usage of helmet in default configuration blocks graphql playground to open

Viewed 478
app.use(xss());//safety against XSS attack or Cross Site Scripting attacks

app.use(helmet());
httpServer.listen(process.env.PORT || 4000, () => {
      console.log(
        ` Server ready at http://localhost:${process.env.PORT || 4000}${
          server.graphqlPath
        ` Server ready at http://localhost:${process.env.PORT || 4000}${server.graphqlPath
        }`
      );
      console.log(
        ` Subscriptions ready at ws://localhost:${process.env.PORT || 4000}${
          server.subscriptionsPath
    
        }`
      );
    });

I am using graphQL and helmet at the same time. I think which is stopping my graphQL api playground. THIS MY CODE I CANT RESOLVE PLS HELP. enter image description here

1 Answers

hey shresth try using this in your program

app.use(helmet({ contentSecurityPolicy: (process.env.NODE_ENV === 'production') ? undefined : false })); 
Related