Trying to self-host on a laptop with accessibility via VPN on another host on the same network

I’m trying to host n8n on a laptop on my home network, and make it accessible from outside via a VPN hosted on a Raspberry Pi also on the home network, using the Compose and environment file from the documentation on Docker Compose, minus the Traefik container. The only change I made from the example was deleting the reverse proxy from the Compose file…but now n8n is only accessible on the laptop on which it’s hosted.

What is the error message (if any)?

When trying to access n8n from another device on the same network, I get a DNS_PROBE_POSSIBLE error on the browser.

Information on your n8n setup

  • n8n version: latest
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): unknown
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Fedora 42

if you removed the Traefik reverse proxy from the Docker Compose example and are running n8n directly, n8n will only be accessible on the host machine by default. This is because, in the Compose file from the documentation, the n8n service is configured to bind to `127.0.0.1:5678:5678`, which restricts access to localhost only. Other devices on your network (or via VPN) cannot reach it because it is not listening on the external network interface.

To make n8n accessible from other devices on your network, you need to change the port binding in your `docker-compose.yaml` file from:

```yaml

ports:

  • “127.0.0.1:5678:5678”

```

to:

```yaml

ports:

  • “5678:5678”

```

This change will allow n8n to listen on all network interfaces, making it accessible from other devices on your LAN or via VPN.

**Note:**

- Without a reverse proxy like Traefik or Nginx, you will not have SSL/TLS (HTTPS) enabled, and n8n will be accessible over plain HTTP, which is not secure for production use.

2 Likes

Thanks! Since I’m only using this for personal fun on my home network only, I feel like production level security is probably not necessary. Am I on the right track with that guess?

1 Like

I got it working! I had to change my Compose file to be the following:

services:

n8n:

image: docker.n8n.io/n8nio/n8n

restart: always

ports:

  - "5678:5678"

environment:

  - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true

  - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}

  - N8N_PORT=5678

  - N8N_PROTOCOL=https

  - N8N_RUNNERS_ENABLED=true

  - N8N_SECURE_COOKIE=false

  - NODE_ENV=production

  - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/

  - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}

  - TZ=${GENERIC_TIMEZONE}

volumes:

  - n8n_data:/home/node/.n8n

  - ./local-files:/files

volumes:

n8n_data:

GAH FORMATTING IS HARD

1 Like

VPN configurations can make self-hosting challenging. I’ve been using Spaceship vpn online to remotely access my work setup, and although it functions fairly well for simple connections, there isn’t much documentation available for more complex networking situations. had port forwarding problems that took a very long time to resolve. Additionally, their interface seems antiquated. It’s acceptable for basic remote access, but if you’re doing intricate self-hosting, you may encounter some annoying restrictions. But that’s just my experience.