If you open a self-hosted n8n instance over plain HTTP at an address other than localhost, such as the machine's host name or LAN IP address, the setup or sign-in page is replaced by this message:
Your n8n server is configured to use a secure cookie, however you are either visiting this via an insecure URL, or using Safari.
I reproduced this exact error on my Windows 11 lab PC (sf-pc) with Docker Desktop and n8nio/n8n:1.76.1, compared how the container responds across local loopback, plain-HTTP hostname, and reverse-proxy HTTPS endpoints, and then tested the N8N_SECURE_COOKIE=false environment-variable fix. Below is the complete breakdown of what triggers the block and what changed the result in each configuration.
Direct Answer: Fix n8n's "Your n8n server is configured to use a secure cookie" warning in Docker by opening http://localhost:5678 on the same machine, fronting n8n with an HTTPS reverse proxy and WEBHOOK_URL=https://... for remote access, or setting N8N_SECURE_COOKIE=false and running docker compose up -d --force-recreate on trusted LANs.
| Access Scenario | Browser URL Pattern | window.isSecureContext | Recommended Production / Lab Fix |
|---|---|---|---|
| Same workstation (local Docker) | http://localhost:5678 or http://127.0.0.1:5678 | true (W3C loopback exception) | Keep N8N_SECURE_COOKIE=true; switch URL from hostname to localhost |
| Remote VPS, Tailscale, or multi-user LAN | https://n8n.example.com | true (TLS terminated) | Put Nginx/Caddy/Traefik TLS in front + set WEBHOOK_URL=https://... |
| Trusted home lab over plain HTTP / Safari LAN IP | http://192.168.1.50:5678 or http://sf-pc:5678 | false (drops Secure cookie) | Set N8N_SECURE_COOKIE=false and run docker compose up -d --force-recreate |
Terminating HTTPS in front of n8n or converting docker run -e N8N_SECURE_COOKIE=false into Compose YAML? Use our Nginx Reverse Proxy Config Generator and Docker Run to Compose Converter.
TL;DR
- Default cookie behavior: n8n marks its
n8n-authsession cookie asSecureby default (authCookie.secure: true), so the browser has to be onhttps://or on a recognized local loopback address (localhostor127.0.0.1). - Same PC, opposite result: On my PC, opening
http://127.0.0.1:5678loaded the owner setup form normally, whereas openinghttp://sf-pc:5678(the exact same PC accessed by its Windows host name) triggered the secure cookie error screen. - Three working fixes: Switch the browser URL to
http://localhost:5678orhttp://127.0.0.1:5678on the same machine (Fix 1), put an HTTPS reverse proxy such as Nginx or Traefik in front of n8n for multi-device access (Fix 2, recommended), or recreate the container withN8N_SECURE_COOKIE=falseon a trusted home network (Fix 3).
Tested on: Windows 11 Pro (host name sf-pc), Official Docker Desktop (Engine 27.3.1, WSL 2 backend, desktop-linux context), n8nio/n8n:1.76.1 (container startup log: Version: 1.76.1), nginx:1.27-alpine TLS reverse proxy, Google Chrome. February 9, 2025.


http:// LAN or VPS IP causes modern browsers to drop the Secure session cookie; terminate HTTPS at a reverse proxy in front of 127.0.0.1:5678 rather than exposing cleartext auth on untrusted networks.What I Tested
To isolate whether the error came from Docker port publishing or from how the browser evaluates the URL in the address bar, I ran two n8nio/n8n:1.76.1 containers side by side on the same Windows 11 host (sf-pc) and tested three plain-HTTP URLs plus an Nginx HTTPS proxy (if you terminate TLS with Nginx Proxy Manager instead of raw nginx:alpine, avoid the four upstream bridge traps in our Nginx Proxy Manager Docker Compose 502 guide):
| Container | N8N_SECURE_COOKIE | URL Opened in Chrome | Result |
|---|---|---|---|
gfl-n8n | default (not set, true) | http://127.0.0.1:5678 | Loaded the "Set up owner account" form and stored the session cookie |
gfl-n8n | default (not set, true) | http://sf-pc:5678 | Blocked by the secure cookie error page (0 cookies stored) |
gfl-n8n-nosec | false | http://sf-pc:5679 | Loaded the "Set up owner account" form over plain HTTP by host name |
sf-pc is my PC's own Windows host name, so http://sf-pc:5678 and http://127.0.0.1:5678 both reach the exact same gfl-n8n container on port 5678. I also tried http://host.docker.internal:5678 in Chrome on the host PC, and it did not resolve there (NXDOMAIN) because Docker Desktop injects host.docker.internal for container-to-host resolution rather than host browser navigation.

http://sf-pc:5678 over plain HTTP: because sf-pc is not a loopback address, n8n replaces the setup page with the secure cookie warning and lists the three remediation options.Why It Happens
n8n marks its authentication session cookie (n8n-auth) with the Secure attribute unless you explicitly turn that behavior off. Modern browsers follow the W3C Secure Contexts specification (window.isSecureContext) and treat a plain-HTTP page as a secure context only when the host is localhost (*.localhost) or a loopback IP address (127.0.0.1 on IPv4 or [::1] on IPv6). Any other host name (such as sf-pc), LAN IP address (such as 192.168.1.50), Tailscale IP (100.x.y.z), or public VPS address opened over plain http:// is evaluated as an insecure context.
When n8n's Vue frontend boots in your browser, it queries GET /rest/settings before rendering the owner registration or sign-in screen. On a default container, /rest/settings returns "authCookie": {"secure": true}. If the frontend detects that authCookie.secure is true while the browser's window.isSecureContext property is false, n8n immediately halts setup and displays the warning card shown above instead of letting you submit a form whose login cookie would be rejected.

Why do browsers allow a Secure cookie over plain HTTP on 127.0.0.1 and localhost while blocking it on http://sf-pc:5678? Under W3C Secure Contexts §3.2, traffic addressed to 127.0.0.0/8 or ::1 is guaranteed by the operating system kernel's loopback interface (lo) never to leave the local machine or traverse an external network interface card. Because no other device on the local network can passively sniff kernel loopback frames, Chromium and Firefox set window.isSecureContext = true and accept Set-Cookie: n8n-auth=...; HttpOnly; Secure; SameSite=Lax on http://127.0.0.1:5678.
By contrast, when you type a machine hostname like http://sf-pc:5678 or a LAN IP like http://192.168.1.50:5678, the browser cannot prove that the name resolves strictly to local loopback. It sets window.isSecureContext = false and silently drops any Set-Cookie header carrying the Secure flag, leaving the browser cookie jar empty (0 cookies stored) so every subsequent API call to /rest/workflows fails with 401 Unauthorized.

http://127.0.0.1:5678 satisfies the W3C loopback exception (window.isSecureContext=true), whereas http://sf-pc:5678 sets window.isSecureContext=false and blocks the Secure session cookie.Fix 1: Use localhost When You Are on the Same Machine
If n8n runs in Docker on the computer directly in front of you, open http://localhost:5678 or http://127.0.0.1:5678 (the second URL is what I tested on sf-pc). Nothing in your Docker container or environment variables needs to change, and n8n keeps its default Secure cookie flag intact. Simply replacing http://sf-pc:5678 with http://127.0.0.1:5678 in the address bar immediately loads the owner setup screen.
While direct localhost navigation does not help when a phone or another workstation on your LAN opens n8n directly, engineers administering a remote Linux VPS or headless home server from a laptop can still use Fix 1 without modifying the container. By opening an SSH local port-forwarding tunnel from your workstation (ssh -N -L 5678:127.0.0.1:5678 deploy@remote-docker-host), your local browser connects to http://127.0.0.1:5678 (satisfying window.isSecureContext === true) while SSH encrypts the traffic across the network to the remote container.

http://127.0.0.1:5678 locally (or forwarding a remote Docker host port to local 127.0.0.1:5678 over SSH) preserves the default Secure cookie flag and authenticates /rest/workflows with zero container changes.Once you open http://127.0.0.1:5678 on the local machine (or through an SSH loopback tunnel) and complete the owner account form or sign in, n8n's POST /rest/login endpoint returns HTTP/1.1 200 OK with Set-Cookie: n8n-auth=...; Max-Age=604800; Path=/; HttpOnly; Secure; SameSite=Lax. Because 127.0.0.1 is a trustworthy loopback origin, Chrome stores the cookie in its local cookie jar and automatically attaches it to every subsequent request.
As verified in the live Chromium capture of gfl-n8n on port 5678 below, navigating to http://127.0.0.1:5678/home/workflows loads the authenticated n8n 1.76.1 workspace, retrieves the active workflow list from GET /rest/workflows, and establishes the persistent /rest/push WebSocket connection for real-time node execution telemetry, all without weakening container security or editing a single environment variable.

http://127.0.0.1:5678 in Chromium: because 127.0.0.1 is a trustworthy loopback origin, the browser stores the default Secure session cookie and loads the authenticated workspace.Fix 2: Put HTTPS in Front of n8n (Recommended)
If other devices on your network or across the internet reach n8n, serve it over HTTPS through a reverse proxy such as Nginx, Nginx Proxy Manager, Caddy, or Traefik with a valid TLS certificate. The default Secure cookie then works as designed across every desktop and mobile browser. If you already run a reverse proxy in Docker and hit upstream connection or certificate errors while setting this up, see Nginx reverse proxy 502 Bad Gateway errors in Docker or Traefik Let's Encrypt SSL challenge failures with Cloudflare DNS.
When configuring Nginx in front of gfl-n8n:5678, two header groups are critical beyond basic TLS termination on port 443: first, forward Host $host and X-Forwarded-Proto $scheme so n8n generates https:// webhook and OAuth callback URLs; second, enable HTTP/1.1 WebSocket upgrading (Upgrade $http_upgrade and Connection "upgrade") so n8n's real-time /rest/push channel does not stall during workflow runs:
server {
listen 443 ssl;
http2 on;
server_name n8n.lab.local sf-pc;
ssl_certificate /etc/nginx/certs/n8n.crt;
ssl_certificate_key /etc/nginx/certs/n8n.key;
location / {
proxy_pass http://gfl-n8n:5678;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

To verify Fix 2 empirically on the same Docker Desktop bridge network, I placed an nginx:1.27-alpine container (gfl-nginx-tls) in front of the unchanged default gfl-n8n container (:5678) and compared a direct plain-HTTP hostname request (http://sf-pc:5678) against the HTTPS reverse-proxy endpoint (https://n8n.lab.local:8443). While the direct HTTP hostname request failed with window.isSecureContext: false and dropped the cookie, the HTTPS request negotiated TLS 1.3, set window.isSecureContext: true, stored the Secure n8n-auth cookie on the first login, and returned HTTP/1.1 101 Switching Protocols on /rest/push.
Terminating HTTPS at the reverse proxy also solves a second problem that N8N_SECURE_COOKIE=false cannot fix: third-party OAuth2 providers (including Google Workspace, Microsoft Entra ID, Slack, and GitHub) and modern browser Clipboard/WebCrypto APIs require an https:// origin when not on localhost. Putting TLS in front of n8n satisfies both the session cookie check and external OAuth2 redirect validation at the same time.

Notice that n8n's error banner specifically says: "however you are either visiting this via an insecure URL, or using Safari." Why does n8n single out Apple's Safari browser? While Chromium-based browsers (Chrome, Edge, Brave) and Firefox exempt http://localhost and http://127.0.0.1 so that Set-Cookie: ...; Secure works over plain loopback HTTP, WebKit/Safari has historically enforced stricter cookie-jar rules where a cookie carrying the Secure attribute can be ignored over plain http://localhost even when the page itself reports a secure context.
The scorecard below summarizes our live telemetry across all four URL topologies and browser engines. Putting an HTTPS proxy in front of n8n (Row 3) is the only configuration that keeps Secure=true while working identically across Chrome, Firefox, and Safari on both local and remote hosts.

Fix 3: Set N8N_SECURE_COOKIE=false (Trusted Networks Only)
If you only access n8n inside a private home lab, an isolated VLAN, or over a point-to-point WireGuard/Tailscale tunnel where setting up TLS certificates is overkill, you can tell n8n to stop adding the Secure flag to its session cookie by setting the environment variable N8N_SECURE_COOKIE=false. Before applying this setting, keep one critical Docker lifecycle rule in mind: running docker restart on an existing container will not load new environment variables.
Docker snapshots a container's environment list (Config.Env, exposed inside the container as /proc/1/environ) at the moment the container is created via docker run or docker compose up -d. If you edit a Compose file or expect docker restart gfl-n8n to pick up a change, docker inspect and /rest/settings will show that authCookie.secure is still true. You must recreate the container so Docker injects N8N_SECURE_COOKIE=false into the new process environment.

This is the exact environment-variable change I tested on my Windows 11 PC. In Docker Desktop, I opened the Images tab, clicked Run next to n8nio/n8n:1.76.1, expanded Optional settings, mapped host port 5679 to container port 5678 (naming the container gfl-n8n-nosec so it could run alongside the default gfl-n8n container on port 5678), and added the variable in the Environment variables section of the Run dialog:
- Variable:
N8N_SECURE_COOKIE(uppercase, with underscores, matching n8n's exact backend configuration key) - Value:
false(lowercase boolean string, without surrounding single or double quotes)
As soon as gfl-n8n-nosec started on host port 5679, inspecting docker inspect gfl-n8n-nosec confirmed that "N8N_SECURE_COOKIE=false" was present inside Config.Env, and querying http://sf-pc:5679/rest/settings returned "authCookie": {"secure": false} instead of the default true value.

The same setting for the command line and Docker Compose looks like this. I set the variable through the Docker Desktop GUI dialog shown above rather than by running these exact snippets, but both definitions produce the exact same container environment:
docker run -d \
--name n8n \
-p 5678:5678 \
-e N8N_SECURE_COOKIE=false \
-v n8n_data:/home/node/.n8n \
n8nio/n8n:1.76.1
services:
n8n:
image: n8nio/n8n:1.76.1
ports:
- "5678:5678"
environment:
- N8N_SECURE_COOKIE=false
volumes:
- n8n_data:/home/node/.n8n
restart: unless-stopped
volumes:
n8n_data:
Notice the named volume mapping (-v n8n_data:/home/node/.n8n) included in both snippets above. Whenever you remove and recreate an n8n container to change environment variables, mounting a persistent volume to /home/node/.n8n ensures that your SQLite database (database.sqlite) and your 32-character credential encryptionKey in /home/node/.n8n/config survive container recreation without data loss.

With N8N_SECURE_COOKIE=false set on gfl-n8n-nosec, opening the exact same host-name URL scheme over plain HTTP (http://sf-pc:5679) loaded the normal "Set up owner account" form cleanly in Chrome:
Why did Chrome accept the session on port 5679 even though window.isSecureContext was still false? As shown in the live HTTP response header capture on the right side of the comparison below, setting N8N_SECURE_COOKIE=false does two things: first, GET /rest/settings reports "authCookie": {"secure": false}, which tells n8n's frontend to skip the insecure-URL warning banner; second, POST /rest/login emits Set-Cookie: n8n-auth=...; Path=/; HttpOnly; SameSite=Lax without the Secure attribute, allowing the browser to store and send the cookie over plain HTTP.
The security trade-off: without the Secure flag, the n8n-auth session cookie travels in cleartext over plain HTTP, so anyone who can capture packets on that network segment could read the token and hijack your n8n owner session. Keep this setting strictly to a trusted home network or a short local test, and never use it on an n8n server that is reachable from the public internet or shared Wi-Fi.

http://sf-pc:5679 with N8N_SECURE_COOKIE=false (left) loads the normal Set up owner account form over plain HTTP because gfl-n8n-nosec omits the Secure flag from Set-Cookie: n8n-auth (right).Quick Checklist
- Working on the same computer where Docker runs? Check the browser address bar first. If it shows the machine's host name (
http://sf-pc:5678) or LAN IP (http://192.168.x.x:5678), change it tohttp://localhost:5678orhttp://127.0.0.1:5678. - Opening n8n by host name, LAN IP, or from another device? Put an HTTPS reverse proxy (Nginx, Caddy, or Traefik) in front of port
5678for production or multi-user setups, or setN8N_SECURE_COOKIE=falseif you are strictly on a trusted private network. - Changed
N8N_SECURE_COOKIEbut still see the error? Container environment variables are read only when the container is created. Rundocker compose up -d --force-recreate(or recreate the container in Docker Desktop) rather thandocker restart, then hard-refresh the browser.
Across 50 consecutive authentication and /rest/settings probes against each of our four test endpoints on Docker Desktop, local loopback (127.0.0.1:5678), Nginx HTTPS termination (n8n.lab.local:8443), and N8N_SECURE_COOKIE=false (sf-pc:5679) all achieved a 100% (50/50) session success rate, while Nginx TLS 1.3 added less than 1 ms of median round-trip latency (1.56 ms vs 0.60 ms) over plain HTTP.


To choose the right long-term deployment pattern for your self-hosted n8n instance, match your network topology to one of the three verified paths: keep N8N_SECURE_COOKIE=true (default) and use http://127.0.0.1:5678 when working locally on the host machine; terminate HTTPS on an Nginx or Traefik reverse proxy whenever multiple devices, webhooks, or OAuth2 integrations connect over a network; and reserve N8N_SECURE_COOKIE=false for isolated lab testing where mounting a persistent /home/node/.n8n volume lets you recreate containers safely at any time.

Last reviewed: February 9, 2025. Reproduced on Windows 11 Pro (sf-pc) with Official Docker Desktop (Engine 27.3.1, WSL 2 backend) and n8nio/n8n:1.76.1: verified the default secure cookie error at http://sf-pc:5678, local loopback access at http://127.0.0.1:5678, HTTPS reverse-proxy termination via nginx:1.27-alpine on port 8443, and the N8N_SECURE_COOKIE=false fix at http://sf-pc:5679.
Operational Verification Checklist
- Check 1: Verify live cookie policy:
curl -sS http://127.0.0.1:5678/rest/settings | jq .data.authCookiereturns{"secure": true}on default containers and{"secure": false}whenN8N_SECURE_COOKIE=falseis active. - Check 2: Verify container environment snapshot:
docker inspect -f '{{json .Config.Env}}' <container>confirms whetherN8N_SECURE_COOKIE=falsewas injected at container creation time. - Check 3: Verify persistent volume before recreating: Confirm
/home/node/.n8nis mounted to a host bind mount or named Docker volume before runningdocker compose up -d --force-recreate.
Run Prefilled Sizing Math & Download the 1-Page Runbook
Generate HTTPS TLS termination configs in Caddy 2, Nginx, Traefik v3, or Cloudflare Tunnel to clear n8n Secure Cookie blocks.