Description:
I am encountering an issue with setting up the Google OAuth credentials in n8n when running n8n in Docker behind an NGINX reverse proxy. Despite following the n8n documentation, perusing the posts in this community, and setting the WEBHOOK_URL environment variable in the docker-compose.yml file, the OAuth Redirect URL still points to http://localhost:5678/rest/oauth2-credential/callback instead of my public-facing domain.
Here is a summary of the steps I followed and the issue I encountered:
n8n Setup:
n8n is running in a Docker container on my VPS.
NGINX is acting as a reverse proxy, exposing n8n via a public domain (https://n8n.example.com).
Google OAuth credentials are configured in n8n.
Steps Taken:
I followed the documentation and set the WEBHOOK_URL to https://n8n.example.com/ In the docker-compose.yml and I added the following environment variables:
environment:
- N8N_HOST=n8n.example.com
- N8N_URL=https://n8n.example.com
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.example.com/
Issue:
Despite these changes, the OAuth redirect URL is still being generated as http://localhost:5678/rest/oauth2-credential/callback in n8n.
I also tried setting the N8N_URL and WEBHOOK_URL environment variables in the Docker container, but it did not resolve the issue.
What I Expected:
I expected n8n to generate the correct OAuth Redirect URL and Webhook URL based on the public domain (https://n8n.example.com/) that n8n is exposed to via the reverse proxy.
What I Have Tried:
I tried modifying the docker-compose.yml file and restarting the container.
I also ensured that the NGINX reverse proxy is properly forwarding traffic to the correct n8n backend.
Request:
Could you help identify why n8n is still generating the incorrect OAuth Redirect URL (localhost) despite setting the WEBHOOK_URL and N8N_URL environment variables correctly in the Docker configuration?
Any additional configuration changes or troubleshooting steps would be greatly appreciated.
System Information:
Information on your n8n setup
- N8N Server:
* n8n version: 1.72.1
* Docker version: 27.4.1, build b9d17ea
* Docker Compose Version: v2.32.1
* Operating System: Debian 12
* **VPS:**
* **NGINX version:** 1.22.1-9
* **Operating System:** Debian 12