# Browser monitors: Issues with Content Security Policy

**URL:** <https://community.dynatrace.com/t/browser-monitors-issues-with-content-security-policy/43403>\
**Category:** Troubleshooting\
**Tags:** browser-monitors, synthetic-monitoring\
**Created:** [January 10, 2024, 6:00pm UTC](https://community.dynatrace.com/t/browser-monitors-issues-with-content-security-policy/43403 "2024-01-10T18:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandini\_balakri](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/nandini_balakri/32/13262_2.png) [@nandini\_balakri](https://community.dynatrace.com/u/nandini_balakri)\
**Post date:** [January 10, 2024, 6:00pm UTC](https://community.dynatrace.com/t/browser-monitors-issues-with-content-security-policy/43403/1 "2024-01-10T18:00:00Z")

</div>

## **Summary**

This article explains how to troubleshoot **[Content Security Policy (CSP)](https://dt-url.net/q1e1pkl) issues** in Dynatrace Browser monitors.CSP restrictions can block scripts, resources, or requests required for Synthetic monitoring execution, leading to failed or incomplete monitor runs.  
Unfortunately, the applied CSP settings are likely to prevent the browser from sending monitoring data to the Dynatrace Cluster

## **Problem**

When running a Dynatrace Browser monitor:

- The monitor fails to execute correctly
- Scripts or resources do not load
- Page behavior differs from manual testing

This commonly occurs on applications with strict **Content Security Policy (CSP)** rules.

## Preferred solution: Monitor settings

As a first and preferred method to bypass the CSP of any monitored pages in your single-URL browser monitor or browser clickpath, enable **Bypass Content Security Policy (CSP) of monitored pages** in monitor settings. You can do this in **Additional options** when creating a browser monitor or in **Advanced setup** in monitor settings in edit mode.

 ![bypass-csp-browser-monitor.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/3/4370b26fa9d01349270da77c965bb89a61d26c9e.png)

If you’re unable to use this option for some reason, refer to the advanced methods for bypassing CSP below.

## Advanced methods to bypass CSP

Your CSP rules, such as the following, prevent Dynatrace from sending requests to a path relative to the page URL.

`"Content-Security-Policy: default-src https: data: 'unsafe-inline' 'unsafe-eval'"`

If you use custom JavaScript events, you may see the following JavaScript error.

`Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed`. To avoid this, your page needs to allow `script-src unsafe-eval`.

In other cases, you must modify the page to allow connections relative to the URL. The following are example scenarios.

### Example 1

CSP settings specified by using the `<meta>` tag are likely to prevent the browser from sending monitoring data to Dynatrace Cluster.

To resolve this issue, you can either set up a CSP HTTP header by replacing any existing CSP `<meta>` tag or add your environment URL to CSP, as shown below.

```auto
<meta
 http-equiv="Content-Security-Policy" content="default-src 'self'; 
connect-src 'self' https://{your environment id}.live.dynatrace.com">

```

### Example 2

A page loaded from `http://www.mydomain.com` returns no data in the UI because the CSP settings specify `connect-src https://`.

In such a case, you can try either of the following.

-Add `http://` to `connect-src`.

-Switch the test to load `https://www.mydomain.com` instead of `http://www.mydomain.com`.

### Example 3

A page loaded from `http://www.mydomain.com` returns no data in the UI because the CSP rules specify `connect-src http://*.mydomain.com`.

In this case, add `http://` to `connect-src`.

## What’s Next

If none of the previous steps resolved the issue, open a chat and provide a link to your Browser Monitor, and the troubleshooting steps you have already completed.

### Related reading

📖&nbsp;&nbsp;[Synthetic Troubleshooting Map](https://community.dynatrace.com/topic/250426)

📖&nbsp;&nbsp;[Bypass Content Security Policy (CSP) of monitored page](https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring/browser-monitors/configure-browser-monitors#bypass-csp)
