Using ngrok with n8n to make your workflow public
n8n allows you to self-host, which is great when you're testing workflows; but when you're ready to turn your instance into a production-ready automation and don't want to buy a domain or pay for hosting, you might feel lost.
This guide walks you through how to get your self-hosted n8n instance running in Docker live on the internet. We'll show you how to set up ngrok with Docker or or with the agent CLI, get your static domain, and protect your endpoint, all for free with ngrok.
Set up your local server with n8n
Follow the steps listed in n8n's docs to self-host n8n in Docker.
1. Connect ngrok to your account
Sign up for an account at ngrok.com and get your auth token.
2. Install ngrok
Install ngrok via Docker with the following command:
Loading…
Run ngrok via Docker:
Loading…
3. Claim your free static domain
Claim your free static domain in the dashboard. It should look something like happy-rabbit-partially.ngrok.free.app
.
Copy this domain to use in the next step.
4. Launch a new container in Docker
Launch a new container in Docker with updated environment variables including your ngrok domain.
- Create a new container in Docker, and assign it to port
5678
.tipReuse the same volume or bind mount for the data folder in your old n8n container. The host path must stay the same. This will ensure that your n8n workflows, credentials, or execution history are not impacted.
- Create two environment variables, pasting in your ngrok URL as the value, and making sure it starts with
https://
.
Loading…
- Lastly, add the following environment variable:
Loading…
When you set the value to filesystem, n8n saves large files as binary data during workflow runs so your processes executes quickly.
Once this is done and the new container with your ngrok domain is launched:
- Delete the old container
- Hit the run button to create your new container running on ngrok
5. Test your integration
Open http://localhost:5678
and log in with your credentials. You should see everything you had locally.
6. Expose your server with ngrok
Start an endpoint at your app's port:
Loading…
Navigate to your ngrok domain. You should be able to access it from anywhere now.
Example use case
This example will teach you how to limit access to your n8n server from IPs associated with Tor exit nodes using ngrok's Traffic Policy and IP Intel.
1. Create a Traffic Policy
Locally, save this file as policy.yml
:
Loading…
2. Restart the agent
Restart your ngrok agent with the --traffic-policy-file
argument.
Loading…