An n8n credential can be used in an HTTP Request node, which calls whatever address you type. That’s handy, but it also means a key meant for one API can be sent to another site, by mistake or by anyone who edits the workflow. Allowed HTTP Request Domains closes that gap: the credential only works for the domains you list.
This guide uses a small example: a Header Auth credential for an API at example.com, used in an HTTP Request node. You allow example.com and see the request run, then allow only api.example.com and see n8n refuse it.
Every screen and output on this page is real, run with n8n 2 in Docker on macOS.
What You’ll Have
A credential that n8n uses only for the domains you choose, and the message n8n shows when a request goes anywhere else.
Step 1: Use a Credential in an HTTP Request Node
Create a workflow named Domain check with a manual trigger and an HTTP Request node. In the node, set URL to https://example.com/, Authentication to Generic Credential Type and Generic Auth Type to Header Auth. Then click Connect to Header Auth:
In the new credential, type X-API-Key as the Name, the header your API expects, and the key as the Value. For this test, any value will do.
Step 2: Choose the Domains It May Call
Open Allowed HTTP Request Domains. It has three choices:
- All lets the credential go to any address.
- Specific Domains lets it go only to the domains you list.
- None blocks it in HTTP Request and GraphQL nodes altogether.
Choose Specific Domains. A new field, Allowed Domains, appears. Type example.com. To allow more than one, separate them with commas, as the field’s own hint shows. Click the credential’s name, rename it Example API key, and click Save:
Step 3: Run a Request to an Allowed Domain
Back in the node, click Execute step. The address is on example.com, so n8n sends the request with the key, and the page comes back:
Step 4: See a Request Refused
Click the pencil next to the credential, change Allowed Domains to api.example.com and save. The URL still points at example.com, so when you click Execute step again, n8n refuses the request:
Output
Domain not allowed: This credential is restricted from accessing example.com. Only the following domains are allowed: api.example.com
With None chosen instead, the same run stops with This credential is configured to prevent use within an HTTP Request or GraphQL node.
The setting only guards HTTP Request and GraphQL nodes. When an app’s credential is used in that app’s own node, such as the n8n API credential in the n8n node, the field has no effect.
Clean Up
Open Domain check, click ⋯ next to its name, then Archive, and then ⋯ › Delete › Yes, delete. On Overview › Credentials, click ⋯ on Example API key, then Delete › Yes, delete.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Leaving All on a credential for one API | Any HTTP Request node can send its key to any site | Choose Specific Domains and list the API’s domain |
| Listing the website’s domain when the API lives elsewhere | Every request fails with Domain not allowed | List the domain in the URL you call, such as api.example.com |
| Expecting the setting to guard the app’s own node | It has no effect there | Use it for credentials you call from HTTP Request nodes |
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Domain not allowed: This credential is restricted from accessing … | The URL’s domain isn’t in Allowed Domains | Add the domain to Allowed Domains, or fix the URL |
| This credential is configured to prevent use within an HTTP Request or GraphQL node | Allowed HTTP Request Domains is None | Choose Specific Domains and list the domains |
FAQ
Which credentials have this setting?
Many credentials for web APIs and services, including the generic ones such as Header Auth, as well as app credentials such as the n8n API credential.
Can I allow more than one domain?
Yes. Type them in Allowed Domains separated by commas. The field’s hint shows example.com, *.subdomain.com as the form.
Does example.com also allow http://www.example.com?
No. A plain domain matches only that exact name, so www.example.com and api.example.com each need their own entry. *.example.com allows every subdomain of example.com but not example.com itself, so list both when you need both.
Does n8n send the key when it refuses a request?
No. n8n checks the address against the list before the request goes out, and checks again if a site redirects the request somewhere else, so the key never travels to a domain you didn’t allow.
Conclusion
A credential for one API should only ever go to that API. Setting Allowed HTTP Request Domains to Specific Domains takes one field, and from then on n8n refuses any HTTP Request that would carry the key somewhere else.
Additional Resources
- Create and edit credentials: Allowed HTTP request domains (n8n docs)
- HTTP Request node (n8n docs)
Related
n8n and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by n8n GmbH.
