Running n8n in private lan using pfsense haproxy

I want to run multiple n8n inside a private network. I will be using pfsense + haproxy to send traffic to the respective VMs (each installed with n8n). This is make sure I just use one public IP. When I do testing with the VM on its own public IP, its working fine. But when I move the VM into a private network, and asked pfsense to divert the traffic from n8n.mydomain.com to private IP let say 192.168.1.1, it will show 2 error, one is 404 page not found error and SSL cannot be generated. I want to make n8n.mydomain.com (WAN example 1.2.3.4) to go to private lan 192.168.1.1. how to do it correctly? Once it is working, I can then clone my VM to make n8n2.mydomain.com and n8n3.mydomain.com and so forth.

(https://docs.n8n.io/getting-started/installation/advanced/server-setup.html)

Hey @bari86, I am not very familiar with either pfsense nor haproxy unfortunately. But seeing you are getting 404 errors, could this be a configuration error in your proxy server? Is your traffic reaching n8n in the first place or is the 404 coming from your proxy server?

By using another VM in the private network, I browse using the n8n VM IP address and it shows 404 page not found. This is for example from 192.168.1.2 to the n8n IP 192.168.1.1.

If from public, it shows SSL error but could not get pass that page even pressing accept the risk button. I do notice when running docker up command, it says SSL error (cannot be fetched).

I looked at caddy server and it might be a good substitute but haven’t tried yet.

Hey @bari86,

That SSL error could be important, If it is not able to setup the SSL certificate it can fail to start if using Traefik. If that is the case it would be worth trying the n8n port directly so using 5678 instead of 443 and seeing if that is running.

1 Like

hi,
it might be. i run my n8n in private lan, so i was not able to get letsencrypt ssl from there. so i changed to pfsense + caddy, run internal cert and use cloudflare ssl. fixed now.

1 Like