DEV Community

Anjaneyulu
Anjaneyulu

Posted on

A CSP-related issue in react application.

Please look into the below steps that followed

  1. Created application using create-react-app
  2. For validating CSP used the ZAP tool, and got the below alerts

Image description

Above calls, we are not doing this from our application, it might be React Engine is calling these calls/API(s) internally.
Added the below code in the app.js file

Image description

we tried to append a response header to resolve the above ZAP tool issues but in the console getting an error “Error: TypeError: Failed to execute 'set' on 'Headers': Headers are immutable.” in the above code while sending a request set the header tried to set the same headers in response

Could you please anyone provide a solution to resolve this CSP-related issue?

Thanks,
Anjaneyulu.

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (1)

Collapse
 
anji484 profile image
Anjaneyulu

Any one please help on the above issue

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →