'self' stands in for whatever your policy already allows):
Why each directive is needed
The messenger loads in a chain, and each step is checked against a different directive — allowing one step does not allow the next:connect-src— the SDKfetch()es the messenger document fromhttps://messenger-app.gleap.io. Having the host inframe-srcis not enough: a fetch of an iframe’s host is still a fetch. (API calls toapi.gleap.ioneed this too.)script-src/style-src— the messenger’s<script>and<link rel="stylesheet">load frommessenger-app.gleap.iointo a frame that inherits your page’s policy.connect-src(wss:) — the SDK openswss://ws.gleap.ioand the messenger openswss://sockets.gleap.io. Thehttps://*.gleap.iowildcard does not cover these: schemes are matched separately, sowss://sources must be listed on their own.frame-src,font-src,img-src,media-src— the widget frame itself, plus fonts, images and media (e.g. attachments, avatars, voice messages) served from Gleap origins.
Content Security Policy errors and add the reported origin to the directive named in the error.
script-src needs 'unsafe-inline' or a nonce (see Nonce-based and strict-dynamic policies below). The SDK loads the messenger into a frame that inherits your page’s policy, and it writes one small inline script into that frame to set the messenger’s route. Without 'unsafe-inline' or a nonce that inline script is blocked, and features that open on a specific route (banners, modals, direct links to a conversation) can render the wrong view. If you would rather not allow 'unsafe-inline' at all, use a nonce.We strongly recommend using the
https://*.gleap.io and wss://*.gleap.io wildcards. The SDK contacts several Gleap subdomains (api.gleap.io, ws.gleap.io, sockets.gleap.io, messenger-app.gleap.io, outboundmedia.gleap.io, app.gleap.io, js.gleap.io), and the list may grow as we ship new features. Note that the https:// wildcard does not cover WebSocket connections — wss:// origins must be allowed separately.WebSockets in connect-src
Gleap uses two WebSocket endpoints, and both must be allowed:
wss://ws.gleap.io— session and event streaming used by the JavaScript SDK.wss://sockets.gleap.io— realtime delivery of conversations and notifications in the messenger.
wss://*.gleap.io.
Gleap previously relied on Pusher for realtime messaging, which required
*.pusher.com entries in connect-src. Realtime traffic now runs entirely on Gleap infrastructure (wss://sockets.gleap.io), so any https://*.pusher.com or wss://*.pusher.com entries you added for Gleap can be removed.Nonce-based and strict-dynamic policies
If your policy is nonce-based, the SDK can carry your nonce on everything it creates, including the messenger bundle and the inline route script described above. This requires SDK 16.3.4 or newer.
The simplest setup is to put your nonce on the SDK’s own <script> tag. The SDK reads it from there automatically, and no further configuration is needed:
Gleap.initialize():
'unsafe-inline' in script-src, and you do not need to allowlist a content hash for the inline script.
Note that 'strict-dynamic' only applies to script directives. frame-src, connect-src, img-src, font-src and media-src still need the origins listed above.