Linux

How to fix Your n8n server is configured to use a secure cookie, however you are either visiting this via an insecure URL, or using Safari.

Means n8n is running with N8N_SECURE_COOKIE=true (the default when N8N_PROTOCOL=https) — but you’re trying to access it via HTTP instead of HTTPS, or through Safari (which enforces stricter cookie rules)

1. Understand why it happens

n8n’s web UI stores the login session in a secure cookie, which:

  • Only works over HTTPS.

  • Is not accepted by Safari if using localhost or IP without HTTPS.

So if you open http://your-domain.com:5678, Safari (or even Chrome) will reject the secure cookie, causing login/session errors.

2. Fix options

Option 1: Use HTTPS (recommended for production)

If your server has a domain name and you plan to use SSL:

# docker-compose.yml
version: '3.3'
services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "443:5678"
    environment:
      - N8N_PROTOCOL=https
      - N8N_PORT=5678
      - N8N_HOST=yourdomain.com
      - WEBHOOK_URL=https://yourdomain.com/
      - N8N_SECURE_COOKIE=true
    volumes:
      - ./n8n_data:/home/node/.n8n
    restart: unless-stopped

Then use a reverse proxy like Nginx or Caddy to handle the SSL certificate (Let’s Encrypt).

Example Nginx snippet:

server {
    listen 443 ssl;
    server_name yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://n8n:5678;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Then visit:
https://yourdomain.com

Option 2: Disable secure cookie (for local development only)

If you are testing n8n locally (no SSL), simply turn off secure cookies:

# docker-compose.yml
version: '3.3'
services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    environment:
      - N8N_PROTOCOL=http
      - N8N_PORT=5678
      - N8N_HOST=localhost
      - N8N_SECURE_COOKIE=false
    volumes:
      - ./n8n_data:/home/node/.n8n
    restart: unless-stopped

Then open:
http://localhost:5678

Option 3: Safari workaround

If you must use Safari without HTTPS:

  • Go to Preferences → Privacy, disable Prevent cross-site tracking temporarily.

  • Or switch to Chrome/Firefox when developing locally.

However, the better fix is Option 2 (disable secure cookies locally)

Thanks for visit my website