/n8n-tutorials

How to change the base URL in n8n?

Learn how to change the base URL in n8n with clear steps to improve security, access, and workflow reliability in your automation setup.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to change the base URL in n8n?

You change the base URL in n8n by setting the environment variable N8N_HOST and (optionally) N8N_PORT, then ensuring your reverse‑proxy (like Nginx, Traefik, or Caddy) points to that same hostname. In almost all production setups, the real change happens in the environment variables + your DNS + your proxy. n8n itself does not have a UI field called “Base URL” — it reads it from environment variables.

 

The correct way to change the base URL in n8n

 

n8n decides its own public-facing URL based on environment variables. The important ones are:

  • N8N\_HOST – the domain you want n8n to think it’s running on (for example: automations.example.com)
  • N8N\_PORT – usually stays 5678 if you're behind a proxy
  • N8N\_PROTOCOLhttps when running behind a reverse proxy
  • WEBHOOK\_URL – optional but important when your internal hostname differs from your external one (prevents incorrect webhook URLs)

Here is what a typical Docker setup looks like when you change the base URL:

environment:
  - N8N_HOST=automations.example.com
  - N8N_PORT=5678
  - N8N_PROTOCOL=https
  - WEBHOOK_URL=https://automations.example.com/  // Ensures external-facing webhooks are correct

After you change these variables, restart the container. n8n will regenerate webhook URLs and treat your new domain as authoritative.

 

Why this matters (quick explanation)

 

n8n uses the base URL for:

  • Webhook URLs – n8n needs to tell external services where to reach it.
  • OAuth callbacks – if the URL is wrong, Google, Slack, etc. will refuse the redirect.
  • Invitation emails and password reset links – these must point to the correct domain.

If the base URL is wrong, you get webhook failures, OAuth auth problems, and broken system links.

 

Behind a reverse proxy? (Most real setups)

 

Almost every production n8n uses a reverse proxy (Traefik/Nginx/Caddy) to handle HTTPS. In that case:

  • Your proxy handles SSL certificates and public HTTPS
  • n8n listens internally on http://localhost:5678
  • You still must set N8N_HOST and N8N_PROTOCOL=https so n8n knows its external identity

If you only change the reverse proxy config but not n8n’s environment variables, you’ll often see webhook URLs still pointing to localhost — that’s a common pitfall.

 

Webhook-specific detail

 

n8n sometimes needs a separate explicit URL for webhooks, especially when running inside containers or behind proxies. That’s why WEBHOOK\_URL exists. If you see webhook calls failing or pointing to the wrong place, set it manually:

WEBHOOK_URL=https://automations.example.com/

This overrides internal guesses and forces n8n to generate the correct external URLs.

 

Checklist to avoid common mistakes

 

  • Set N8N\_HOST to the real domain, not the container name.
  • Set N8N\_PROTOCOL=https when using any reverse proxy with SSL.
  • Restart n8n after changing environment variables.
  • Ensure your DNS points the domain to your proxy server.
  • If webhook URLs still look wrong, set WEBHOOK\_URL explicitly.

 

If you follow the above, your base URL will be correct, and n8n will generate valid webhook and OAuth URLs for real production use.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022