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.
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?
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?
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
btw what are the alternatives I have to make a production tunnel without open or close “issues”?
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.
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.