Form url with webhook

Describe the problem/error/question

When using forms with webhook, the url I get in the form node is correct, but part of the n8n url is pre-pended on it.

What is the error message (if any)?

The wrong url results in 404 Not Found error when loading the form.

Please share your workflow

Information on your n8n setup

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

Form Node:

Docker Compose:

services:
  ngrok:
    image: ngrok/ngrok:latest
    container_name: ngrok
    # restart: unless-stopped
    command: http --url=untolerated-ingratiating-jacob.ngrok-free.app --log stdout --log stderr n8n:5678
    ports:
      - "4040:4040"
    environment:
      - NGROK_AUTHTOKEN=${NGROK_AUTHTOKEN}

  postgres:
    image: postgres:17.6-alpine3.22
    container_name: postgres
    # restart: unless-stopped
    environment:
      POSTGRES_USER: n8n
      POSTGRES_PASSWORD: n8n
      POSTGRES_DB: n8n
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./initdb:/docker-entrypoint-initdb.d

  n8n:
    build:
      context: .
      dockerfile: Dockerfile.n8n
    container_name: n8n
    # restart: unless-stopped
    entrypoint: ["/docker-entrypoint-custom.sh"]
    depends_on:
      - postgres
      - ngrok
      - qdrant
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=n8n
      - N8N_WORKFLOW_EXPORT_DIR=/home/node/.n8n/workflows
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=untolerated-ingratiating-jacob.ngrok-free.app
    ports:
      - "5678:5678"
    volumes:
      - n8n_data:/home/node/.n8n
      - ./assets:/home/node/.n8n/assets
      - ./workflows:/home/node/.n8n/workflows
      - ./logs:/home/node/.n8n/logs
      - ./scripts:/home/node/scripts
      - ./output:/home/node/output
      - ./docker-entrypoint-custom.sh:/docker-entrypoint-custom.sh

  qdrant:
    image: qdrant/qdrant
    container_name: qdrant
    ports:
      - "6333:6333"
      - "6334:6334"
    volumes:
      - qdrant_data:/qdrant/storage:z

volumes:
  n8n_data:
  postgres_data:
  qdrant_data:

Resulting url:

http://localhost5678/workflow/untolerated-ingratiating-jacob.ngrok-free.app/form-test/4e1e20d4-f759-42c8-8439-87b93f43aa7c

Can you try this setup:

n8n:
  build:
    context: .
    dockerfile: Dockerfile.n8n
  container_name: n8n
  depends_on:
    - postgres
    - ngrok
    - qdrant
  environment:
    - DB_TYPE=postgresdb
    - DB_POSTGRESDB_HOST=postgres
    - DB_POSTGRESDB_PORT=5432
    - DB_POSTGRESDB_DATABASE=n8n
    - DB_POSTGRESDB_USER=n8n
    - DB_POSTGRESDB_PASSWORD=n8n
    - N8N_WORKFLOW_EXPORT_DIR=/home/node/.n8n/workflows
    - N8N_PROTOCOL=https
    - N8N_HOST=untolerated-ingratiating-jacob.ngrok-free.app
    - WEBHOOK_URL=https://untolerated-ingratiating-jacob.ngrok-free.app
    - WEBHOOK_TUNNEL_URL=https://untolerated-ingratiating-jacob.ngrok-free.app
    - N8N_EDITOR_BASE_URL=https://untolerated-ingratiating-jacob.ngrok-free.app
  ports:
    - "5678:5678"
  volumes:
    - n8n_data:/home/node/.n8n
    - ./assets:/home/node/.n8n/assets
    - ./workflows:/home/node/.n8n/workflows
    - ./logs:/home/node/.n8n/logs
    - ./scripts:/home/node/scripts
    - ./output:/home/node/output
    - ./docker-entrypoint-custom.sh:/docker-entrypoint-custom.sh

Changes:

WEBHOOK_URL: Must include https:// protocol

N8N_PROTOCOL: Set to https for secure webhook generation

N8N_HOST: Specify the ngrok domain without protocol

WEBHOOK_TUNNEL_URL: Used for test URLs in development mode

N8N_EDITOR_BASE_URL: Required for frontend editor functionality

Then restart your container

2 Likes

That was it, thanks a lot, I was missing the WEBHOOK_TUNNEL_URL and N8N_EDITOR_BASE_URL, also WEBHOOK_URL was wrong . Didn’t know about those parameters, now it’s working as expected.

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