How to allow public webhook in npm self hosted n8n in windows server

Recently, I migrated my flows that were on the n8n cloud to self hosted, so I had to configure some credentials and also set my new webhooks, initially I saw that my webhooks were pointed to localhost:5678, which I thought I couldn’t access. from outside machines, so I started researching in the community and on some other sites ways to set a new webhook and make it accessible, I used $env:WEBHOOK_URL to change the URL, it changed but it remained inaccessible, then I tried to access the n8n via the machine’s IP (both local and internet) but it didn’t work either, I need help to make this webhook accessible to other machines to make requests

Additionally, I noticed that when I use $env:something, it works but only until the n8n is turned off, when it turns on it would need to be set again, is there any way to leave it fixed? (I read somewhere about a .env file that I could leave, but I don’t know where to create it or what format it should be in notepad)

Information on your n8n setup

  • n8n version: latest
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via npm
  • Windows Server:

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hey @enzo_botoloto,

Welcome to the community :raised_hands:

I would recommend using the docker approach for running n8n it will be a lot easier to manage if you are unsure on how to manage your windows environment.

To make n8n available from other machines you will need to configure your firewall and make sure your port forwarding is in place, some common options here are to use a tunnel like ngrok / cloudflare instead of opening the firewall or using a reverse proxy that directs the traffic as needed.

The option you should take will depend on your experience and knowledge of managing servers. If you need help we do have some experts who provide installation services.

I like the idea of ​​using Docker, I even installed it, but the way the documentation explains it is 100% via Linux/Ubuntu, and I’m using Windows Server on which Docker works via a graphical interface.

I have my own domain and I think ngrok/cloudflare would work, I would just need some guidance on how to configure it via npm. As a first step, I took my server’s network IP and redirected it to my domain host as a new DNS, setting htkdns.com.br, after that I set htkdns.com.br as my new webhook using $env:WEBHOOK_URL, however It didn’t work, any tips for the next step?

Hey @enzo_botoloto,

Self hosting is an advanced feature and this is the sort of stuff we assume you already know how to do as it technically outside of the scope of n8n.

That being said have you allowed the traffic on your firewall yet and thought about any security implications if you are running this from your house or office?

To set the environment option on windows so it remains for all sessions this looks to be a good place to start: about Environment Variables - PowerShell | Microsoft Learn

With Docker while Windows has a GUI like Mac you can still run the command line options if the Docker service is running.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.