Allowed domains
Each environment of a site has its own list of allowed domains: the production list says where the production snippet runs, the staging list where the staging snippet runs. The snippet on the page (its site key) decides which list applies, never the page's address. For the two environments, see Sites and environments.
| Snippet on the page | Runs on | With an empty list |
|---|---|---|
| Production | the production domains only | nowhere |
| Staging | the staging domains, plus localhost and 127.0.0.1 always |
only localhost and 127.0.0.1 |
When the hostname is not allowed
Section titled “When the hostname is not allowed”The loader mounts no component and fetches no data. The page stays as it is, and the browser console shows one warning that names the snippet the page carries and links to this page. The portal also flags the environment with Seen on a domain that is not allowed and lists the domains seen in the last 24 hours.
The warning appears once per page: five components, or a second copy of the snippet, produce one message.
What the lists protect
Section titled “What the lists protect”- A copied snippet. A component does not mount on another website that copied your snippet, or on a copy of your live website that still carries the production snippet.
- Form submissions from other websites. Taggor compares the
Originof each submission with the list of the snippet's environment and refuses a missing or foreign origin withorigin_not_allowed. Browsers setOrigin, so a page on another website cannot submit to yours. A script outside a browser can set anyOrigin, so the list does not stop that.
What the lists do not protect
Section titled “What the lists do not protect”- Staging is not private. Anyone with the staging site key can load what staging shows. To show work privately, use a preview link (Sites and environments).
- The lists are not access control. The manifest, the loader, the bundles and the lists themselves are public. Who reads the data you collect depends on the role or API key of whoever reads it, in the portal, the CLI or the API.
What an entry can hold
Section titled “What an entry can hold”- A hostname (
example.com) or a wildcard on the first label (*.example.com).www.is removed from a plain entry, becauseexample.comalready coverswww.example.com. - No scheme, port, path or user name:
https://example.comandexample.com:8080are refused, not corrected. - No IP address, except
127.0.0.1written exactly like that. - At least two labels (
localhostis the exception). A wildcard on a public suffix, such as*.com.bror*.github.io, is refused. - The staging list never holds
localhostor127.0.0.1: staging always allows them. - An internationalized name is stored in punycode (
xn--bcher-kva.exampleforbücher.example), which is what the browser reports.
How a hostname is matched
Section titled “How a hostname is matched”The hostname is the page's location.hostname: no scheme, port or path. Case and a trailing dot are
ignored.
| Page hostname | Snippet | Environment's list | Mounts | Why |
|---|---|---|---|---|
example.com |
either | example.com |
yes | equal |
www.example.com |
either | example.com |
yes | www. matches the plain entry |
blog.example.com |
either | example.com |
no | a plain entry does not cover a subdomain |
blog.example.com |
either | *.example.com |
yes | a wildcard covers exactly one label |
a.b.example.com |
either | *.example.com |
no | two labels |
example.com |
either | *.example.com |
no | a wildcard does not cover the bare domain: list both |
myexample.com |
either | example.com |
no | a similar ending is not a subdomain |
localhost, 127.0.0.1 |
staging | any, even empty | yes | always allowed on staging |
localhost, 127.0.0.1 |
production | not listed | no | production runs only where you list it |
localhost, 127.0.0.1 |
production | listed | yes | listed |
| any other IP address | either | any | no | 127.0.0.1 is the only IP address a list can hold |
staging.example.com |
production | example.com |
no | a test copy with the production snippet: use staging's |
| any page | production | empty | no | an empty production list allows nothing |
| any other page | staging | empty | no | an empty list does not mean "any page" |
file://, about:blank |
either | any | no | no hostname |
If the check itself fails in the browser, the component is not mounted and the page is untouched.
Fix a blocked page
Section titled “Fix a blocked page”-
Check the snippet. The warning names the snippet the page carries. A test copy or a local page takes the staging snippet; the live website takes the production snippet.
npx taggor sites snippet SITE_IDprints both, each under its environment's name. Never add a test copy's hostname to the production domains. If your deploy copies the HTML each time, make the snippet address a setting of each of your own environments (an environment variable or a theme option). -
Add the hostname. If the snippet is the right one, add the hostname to that environment's list. In the portal, open the site and choose Edit Production domains or Edit Staging domains. With the CLI:
Terminal window npx taggor sites domains set --site SITE_ID --environment production --domain example.com --domain shop.example.comThe command replaces the whole list of that environment, so name every domain to keep. Running it without
--domainclears the list. -
Wait for the change. Visitors see it within about two minutes.