Skip to main content
A row of brass gate valves on a copper pipe along a charcoal wall with one red valve handle turned shut, a metaphor for n8n SSRF protection blocking requests to internal IP ranges
8 min readBy Carlos Aragon

n8n SSRF Protection: What It Blocks and How to Allow It

n8n SSRF protection is off by default. Turn it on with N8N_SSRF_PROTECTION_ENABLED=true and n8n blocks requests to localhost, Docker host addresses, private LAN ranges and cloud metadata, and on 3.x also Tailscale's 100.64.0.0/10. You let specific internal services back in with N8N_SSRF_ALLOWED_HOSTNAMES or N8N_SSRF_ALLOWED_IP_RANGES. I fired 15 URLs through n8n 2.47.7 and 3.2.2 this morning, with protection off, on, and with five different allowlists. The block list held up against the usual tricks. The surprises were the error messages and one footgun in the config.

What Does n8n SSRF Protection Block?

Server-side request forgery is when someone gets your server to make a request for them. In n8n that's easy to picture: a webhook takes a URL from a form, an HTTP Request node fetches it, and now a stranger is reading http://169.254.169.254/ from inside your cloud account. The protection checks the resolved IP of every outbound request from user-controlled nodes against a block list before it connects.

Here's what one HTTP Request node did with each URL. "Off" is 3.2.2 with no SSRF variables (2.47.7 matched it row for row):

TargetProtection offOn, 2.47.7On, 3.2.2
https://example.com200200200
127.0.0.1 / localhostRefused (nothing listening)BlockedBlocked
host.docker.internal200BlockedBlocked
192.168.x.x LAN router200BlockedBlocked
169.254.169.254 (metadata)4 s timeoutBlockedBlocked
Tailscale 100.x IPReached deviceReached deviceBlocked
Hostname resolving to 100.xReached deviceReached deviceBlocked
127.0.0.1.nip.io (DNS trick)RefusedBlockedBlocked
2130706433 (decimal 127.0.0.1)RefusedBlockedBlocked
0x7f000001 (hex 127.0.0.1)RefusedBlockedBlocked
[::ffff:127.0.0.1]Invalid argBlockedBlocked
[64:ff9b::7f00:1] (NAT64)Invalid argNot blocked*Blocked

* On 2.47.7 the NAT64 address wasn't blocked by policy; the request failed earlier with an invalid-argument error. 3.x adds 64:ff9b::/96 to the list.

The resolved-IP check is what makes it solid. A hostname like 127.0.0.1.nip.io that resolves to loopback, a decimal literal like 2130706433, hex 0x7f000001 and the IPv4-mapped [::ffff:127.0.0.1] all got caught. For the decimal and hex forms the error names 127.0.0.1, so n8n compares the real address, not the string you typed. The metadata endpoint came back with an SSRF error instead of the 4-second timeout I got with protection off.

What Error Does n8n Show When SSRF Protection Blocks a Request?

Not the one the docs tell you to search for. The SSRF environment variable page says a blocked IP fails with "The request was blocked because it resolves to a restricted IP address". On both versions, a direct request got a different message:

// HTTP Request node, N8N_SSRF_PROTECTION_ENABLED=true, n8n 3.2.2
{
  "name": "SsrfBlockedIpError",
  "level": "info",
  "description": "The target 127.0.0.1 is not allowed. This is a security
    measure to prevent Server-Side Request Forgery (SSRF). If you need to
    access internal resources, ask your n8n administrator to allowlist the
    hostname or IP range in the environment configuration.",
  "ip": "127.0.0.1"
}

// Same node, URL on an allowed host that answers 302 -> http://127.0.0.1:5678
"Redirected request failed: The request was blocked because it resolves
 to a restricted IP address"   (ERR_FR_REDIRECTION_FAILURE)

The documented wording only showed up when an allowed host redirected to a blocked one. That part is good news: redirect targets get checked too, so an allowlisted server can't bounce you into loopback.

The bad news is the AI nodes. I pointed an Ollama Chat Model and an OpenAI Chat Model (custom base URL) at a stub server on host.docker.internal. With protection off, the stub logged two requests from each node per run. With protection on, it logged zero, and the nodes said only fetch failed and Connection error. Nothing about SSRF. If you run Ollama next to n8n and your chains die right after someone turned on the setting, this is why, and the error looks exactly like Ollama being down.

Why Did Tailscale Stop Working After the n8n 3.0 Upgrade?

Because n8n 3.0 adds four ranges to the default list, and one of them is 100.64.0.0/10. That's the carrier-grade NAT block, and it's also where every Tailscale address lives. My whole homelab talks over Tailscale, so this is the change I'd have tripped over.

On 2.47.7 with protection on, a request to a Home Assistant box on my tailnet went through (it answered 401 because I sent no token). On 3.2.2, same settings, it was blocked, both by IP and through a hostname that resolved to it. If you only turned protection on after reading a hardening guide and then upgraded, every 100.x call breaks at once.

Two fixes worked. N8N_SSRF_ALLOWED_IP_RANGES=100.64.0.0/10 brought back the whole tailnet, and N8N_SSRF_ALLOWED_HOSTNAMESwith the device's name brought back just that one. Prefer the /32 or the hostname. Allowing all of 100.64.0.0/10 lets any workflow reach any device on your tailnet, which is the thing SSRF protection exists to stop.

A side lesson I learned the hard way: those unauthenticated test calls got my Mac mini's Tailscale IP banned by Home Assistant's ip_ban, and I had to remove it from ip_bans.yaml and restart HA. If you test SSRF rules, aim them at a stub server, not at a real service with login throttling.

How Do I Allow Internal Services Without Turning Protection Off?

The check order is allowed hostname, then blocked hostname, then allowed IP range, then blocked IP range. Allows win. What I'd actually put in a compose file:

# docker compose, n8n service
environment:
  - N8N_SSRF_PROTECTION_ENABLED=true
  # keep the built-in list, add nothing to it unless you mean to
  - N8N_SSRF_BLOCKED_IP_RANGES=default
  # the one Ollama box and the Tailscale node you actually call
  - N8N_SSRF_ALLOWED_HOSTNAMES=ollama,homeassistant.your-tailnet.ts.net
  - N8N_SSRF_ALLOWED_IP_RANGES=100.101.12.34/32

Four things my test runs taught me about writing those lists:

  • Never drop the default keyword. I set N8N_SSRF_BLOCKED_IP_RANGES=100.64.0.0/10meaning "also block this". n8n read it as "block only this". Loopback, the Docker host, my LAN router and the metadata address all opened back up. Write default,100.64.0.0/10.
  • Hostnames beat IPs on Docker Desktop. I allowed 192.168.65.254/32 for the Docker host. host.docker.internal worked, but an alias I mapped with --add-host name:host-gateway resolved to an IPv6 address, fdc4:f303:9324::254, and stayed blocked. Allowing that alias by hostname fixed it.
  • Typos fail quietly.A bad CIDR doesn't stop the boot:
$ docker run ... -e N8N_SSRF_ALLOWED_IP_RANGES=100.64.0.0/33 n8nio/n8n:3.2.2 ...
Invalid value '100.64.0.0/33' in N8N_SSRF_ALLOWED_IP_RANGES: Invalid CIDR notation
# instance boots normally, the range is skipped,
# and the Tailscale call still fails with SsrfBlockedIpError
  • Only allow names you control. A hostname allow skips the IP check entirely, so an entry like *.nip.io would undo the whole feature.

Does SSRF Protection Cover Code Nodes and AI Nodes?

Everything I tried went through it. In a Code node, this.helpers.httpRequest returned the same SsrfBlockedIpError as the HTTP Request node. Plain fetchisn't available in the Code node sandbox at all (fetch is not definedon both versions), so that obvious bypass isn't there. The two LangChain model nodes were blocked too, just with the unhelpful errors above.

It doesn't replace network rules, though.n8n's own docs call it defense in depth, and that's right. It filters what n8n's request helpers send. A community node with its own HTTP client, or a Python runner with network access, isn't something I tested, and I wouldn't assume it's covered. If your n8n faces the internet, put the instance behind something like Cloudflare Access for webhooks and restrict egress at the container or firewall too. And if workflows build URLs from model output, read my notes on n8n prompt injection defense: an injected agent with an HTTP tool is an SSRF waiting to happen.

Should You Turn It On Before Upgrading to 3.0?

Yes, and do it on 2.x first. The feature has existed since 2.12, behaves the same on 2.47.7 apart from the four new ranges, and turning it on separately means you debug one change at a time. My order:

  1. Grep your exported workflows and credentials for localhost, host.docker.internal, Docker service names, 10., 172., 192.168. and 100.. That's your allowlist.
  2. Turn protection on with defaultintact and add those entries. Read the startup log for "Invalid CIDR notation".
  3. Run every workflow that calls an internal service once, AI credentials included, because those won't tell you it's SSRF.
  4. Upgrade. If you use Tailscale, add those hosts before you do. The rest of the 3.0 list is in n8n 3.0 breaking changes, and the Migration Report post covers what n8n's own checker can and can't flag.

If you also lock down environment access, the access to env vars denied post covers the other setting people turn on in the same hardening pass.

FAQ

Is SSRF protection on by default in n8n?

No. N8N_SSRF_PROTECTION_ENABLED defaults to false on both 2.x and 3.x. On a fresh 3.2.2 container with no SSRF variables, the HTTP Request node reached localhost, host.docker.internal, a LAN router and a Tailscale address without any error.

What does 'The target is not allowed. This is a security measure to prevent Server-Side Request Forgery' mean in n8n?

SSRF protection is on and the URL resolved to an IP in the block list, such as loopback, a private range or 100.64.0.0/10 on 3.x. Add the host to N8N_SSRF_ALLOWED_HOSTNAMES or its IP to N8N_SSRF_ALLOWED_IP_RANGES and restart n8n.

Why did my Tailscale requests break after upgrading to n8n 3.0?

n8n 3.0 added 100.64.0.0/10, the carrier-grade NAT range Tailscale uses, to the default SSRF block list. If protection is on, every 100.x address is blocked. Allow the specific node IP as a /32, or allow its MagicDNS hostname.

Why does my Ollama node say 'fetch failed' after enabling SSRF protection?

The Ollama and OpenAI chat model nodes are covered by SSRF protection, but they don't show the SSRF error. In my test both failed with 'fetch failed' or 'Connection error.' and the local server never received a request. Allow the Ollama hostname or IP and they work again.

Can a Code node bypass n8n SSRF protection?

Not in my tests. this.helpers.httpRequest in a Code node returned the same SsrfBlockedIpError as the HTTP Request node, and fetch isn't defined in the Code node sandbox on 2.47.7 or 3.2.2.

How I Tested This

November 13, 2026, on my Mac mini with Docker Desktop: n8nio/n8n:2.47.7 (today's stable tag) and n8nio/n8n:3.2.2. One generated workflow sent 15 URLs through an HTTP Request node with On Error set to continue, plus a Code node probe, and ran through n8n executein a fresh container per configuration: protection off, on, on with a hostname allowlist, on with an IP allowlist, on with a typo, and on with the default list replaced. A small Python server on the host served the allowed target and the 302 redirect and logged every hit, which is how I know the AI nodes never sent a request. Nothing listened on port 5678 inside the containers, so "refused" just means the request was allowed out. I didn't test queue mode workers, community nodes or the Python runner.

Hardening a Self-Hosted n8n Instance?

I lock down n8n instances for teams that run real client data through them: SSRF rules, webhook auth, env access and the 3.0 upgrade, tested against your actual workflows.

Related Posts