Tunnel question


just a question on n8n tunnels. I read a lot of stuff on it and I cannot figured out what is the best way to proceed.

Setting the environment variable N8N_TUNNEL_SUBDOMAIN to something like the-subdomain-i-want should return in a tunnel URL https://the-subdomain-i-want.hooks.n8n.cloud/ . I just tested and it works fine. N8N is directly installed on my laptop. No cloud no docker. But every time i reboot my laptop, the tunnel url changed and I cannot recover the url https://the-subdomain-i-want.hooks.n8n.cloud/ even if the environment variable N8N_TUNNEL_SUBDOMAIN is still set up…

I read that tunnel is just for testing and development. It should not be used for production workflows.
So what can I use for production purpose? I do not want to use a cloud or something like that.

  1. A subdomain can only be chosen if it is not already in use. I am pretty sure that my subdomain is not use…so my thinking is n8n thinks it is still up so until a restart on n8n side I wont be able to use again my subdomain. Is that correct?

Knowing that, is there a way to use n8n without clouds and using in production the subdomain variable?

Thanks a lot!!

The problem is when n8n does not get closed down properly (for example when still open and computer is put in hibernate/sleep). Then the tunnel service “thinks” the subdomain is still in use and that is why you can not use it after a restart.

Thanks a lot for your reply.
Could you please tell me how to launch and close the tunnel properly?
last thing, if the tunnels service thinks the sudomain is still in use is there a way on my side to reset it?


BTW my n8n is on windows thanks

The tunnel gets closed and opened automatically with n8n. So there is nothing to do. You just have to make sure to close n8n properly by for example sending the SIGINT signal to n8n. That can be done in Linux by pressing “Ctrl + c” in the Terminal. Not sure if it is the same on Windows or how it works there.

No sorry, there is sadly nothing that can be done to reset it from your side.

ok that’s clear.
Ctrl+c is not closing the tunnel properly on windows. It is the command I am using :frowning:
btw what are the alternatives I have to make a production tunnel without open or close “issues”?

Hey @herrT15,

The best option would be to set up a domain and port forwarding to your instance from the outside world. So for my home setup I have a domain registered through Namecheap (other options are available), I then pointed the DNS record for n8n.mydomain.com to my home IP address.

From here I set up my router to point port 443 to a reverse proxy that I use to expose a few services to the outside world and it handles SSL / TLS certificates for me with Lets Encrypt. I then point the URL from my reverse proxy to my n8n instance.

The steps you would take would depend on what you have available but the general theory will always be the same. So in my case just to make things more fun I don’t have a static IP so to get around this I have an n8n workflow that runs every 30 minutes to get my current IP then it updates the DNS record for me so if my IP does change it will sort of fix itself.

what a setup!!!
hum…I did not manage to do all this stuff but I will keep an eye on it.
What about using Docker if I do not have a domain?

Hey @herrT15,

Same thing, So if you are not using the tunnel you would need to set up a domain and point it to your n8n instance.

Another option could be to use ngrok which offers a tunnel service but I think for a static URL there is a cost for it.

btw is there a way to make n8n work locally? I mean for example without internet and a webhook url like https://localhost:xxxx/webhook/…

Hey @herrT15,

Yeah you can do that, You can set the webhook url environment option to localhost and that would do the job.

cool! Where can i find that configuration page?

It is an environment variable, The location for that would depend on how you are running n8n.

ok got it! thanks

are you sure it will work without needed an internet access?

As long as you don’t need to use any nodes that connect to any online services you should be ok.

When tring to launch n8n without internet
Running in prod mode
Starting n8n process…
Initializing n8n process

Waiting for tunnel …
[15120:0117/153146.822:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is disabled, ANGLE is

Hey @herrT15,

Ahhh on Desktop it will still try to use the tunnel, I am not sure if there is an option to fully turn it off though. Using npm or docker may be an alternative option for you if you just want to run it locally.

If it is n8n Desktop related @ivov will be the person which knows if something can be done and if so what.

See here:

1 Like