Technical Issue When Exposing n8n via ngrok

I am currently working on an automation project using n8n. My goal is to expose n8n workflows to the internet via NGROK, primarily to enable webhook-based error handling testing and remote triggers.

However, I am facing a persistent issue with basic authentication when accessing n8n through the NGROK URL:

  • The environment variables for authentication (N8N_BASIC_AUTH_USER and N8N_BASIC_AUTH_PASSWORD) are correctly set and verified within the local system and workflows.
  • When accessing n8n locally via localhost and the configured port, login credentials work as expected.
  • When accessing n8n via the NGROK-generated public URL, authentication fails consistently despite using the exact same credentials.
  • NGROK properly forwards traffic to the local machine, and the port forwarding works correctly.
  • The authentication issue prevents successful webhook testing and remote execution of workflows.

I have tried multiple approaches, including setting environment variables at the system level, restarting services, using .env files, and adjusting NGROK commands with host headers, but the issue persists.

Would you be able to assist in diagnosing and resolving this NGROK-related authentication problem? Any guidance on best practices for securely exposing n8n workflows with NGROK or alternative methods would be greatly appreciated.

Thank you for your time and expertise.

The only place those environment variables are mentioned in any of the n8n source repositories is the “Desktop App” which hasn’t been touched in a few years. I’m surprised they do anything, even when accessing via localhost.

Securing a webhook using basic authentication is done by setting a Basic Auth credential item in each Webhook node’s settings. Any chance you have that set too and just thought the env vars were doing it?