---
title: "Restrict where the messenger can load"
description: "Limit the widget to your own domains, and optionally block or allow particular countries."
url: https://help.gleap.ai/fr/articles/275-restrict-where-the-messenger-can-load
collection: "Messenger"
updated: 2026-11-17
language: fr
alternates: [en]
---

# Restrict where the messenger can load

Limit the widget to your own domains, and optionally block or allow particular countries.

Your widget starts with a Project ID that ships in your frontend, so anyone who reads your page source has it. Two settings decide where that Project ID is actually accepted: **Allowed domains** and **Region policy**, both under **Settings → Security**. Project admins only.

### Allow only your own domains

1.  Go to **Settings → Security → Allowed domains**.
    
2.  Click **Add domain**.
    
3.  Enter the base domain without http://, for example example.com. Subdomains are included automatically, and localhost works for local development.
    
4.  Repeat for every domain the widget runs on.
    

From the first entry on, only websites on the listed domains can start your widget. An empty list means no restriction: the widget loads anywhere.

![Allowed domains screen in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/Stw0w9re8cZP9RWuaxyquBvdLJYJ8UACiYkCP94INy3jOj84nfVLFKoD3DlwWgNmzLltNWGwaLs.png)

When you add your first domain, Gleap also adds **playground.gleap.io**. That's the address the dashboard uses for the widget preview, so leave it in.

Set this for any production project. Without it, someone can embed your widget on their own site, and the conversations that arrive look like yours.

> **Warning:** Add every domain you actually use before you rely on the list: your production site, staging, and any local development host. Adding only the production domain is a reliable way to break the widget for your own developers within the hour.

### Block or allow countries

1.  Go to **Settings → Security → Region policy**.
    
2.  Add countries to **Blocked countries** to keep the widget away from them, or to **Allowed countries** to allow only those.
    

Changes save on their own. Region policy is mostly used to cut spam from regions you don't serve, and to keep the widget out of markets where you don't operate.

The rules apply in a fixed order, which matters when you use both lists:

-   With neither list set, everyone gets through.
    
-   A country on the blocked list is refused, even if it's also on the allowed list.
    
-   If the allowed list has any entries at all, every country not on it is refused.
    

So adding one country to **Allowed countries** silently blocks the rest of the world. Use the blocked list to exclude a few places, and the allowed list only when you genuinely serve a fixed set of markets.

### How the country is determined

Gleap uses Cloudflare's view of where the visitor is, based on their IP address. Two consequences:

-   When the location can't be determined, access is allowed rather than refused. The policy fails open, so an unrecognised address doesn't lock a real customer out.
    
-   A customer who is travelling, or on a VPN or a company network that routes traffic through another country, is judged by where they appear to be. Someone in an allowed country can find themselves shut out from an airport.
    

Treat region policy as spam management, not as a security control. For anything that matters, use allowed domains and sign users in with an [identity token](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md).

### Related

-   [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md)
    
-   [Install the Gleap SDK](https://help.gleap.ai/en/articles/228-install-the-gleap-sdk.md)
    
-   [Control what the SDK captures](https://help.gleap.ai/en/articles/365-control-what-the-sdk-captures.md)
