Do not display the authorization page of the n8n editor when accessing the webhook URL

I am running n8n in my docker swarm behind traefik
n8n Version: 1.25.1

version: '3.8'


networks:
  traefik-proxy:
    external: true

secrets:
  n8ndatabaseuserpass:
    external: true
  n8ndatabaseuser:
    external: true  
  

services:
  app:
    image: n8nio/n8n
    logging:
      driver: loki
      options:
        loki-url: "http://data01:3100/loki/api/v1/push"
        loki-external-labels: job=n8n
    volumes:
      - /mnt/storage-pool/appdata/n8n:/home/node/.n8n
    environment:
      TZ: "Europe/Moscow"
      GENERIC_TIMEZONE: "Europe/Moscow"
      N8N_HOST: "n8n.somedomain.net"
      N8N_PORT: "5678"
      N8N_PROTOCOL: "https"
      NODE_ENV: "production"
      WEBHOOK_URL: "https://api.somedomain.net/"
      N8N_EDITOR_BASE_URL: "https://n8n.somedomain.net/"
      N8N_LOG_LEVEL: "info"
      # PostgreSQL
      DB_TYPE: postgresdb
      DB_POSTGRESDB_DATABASE: n8ndb 
      DB_POSTGRESDB_HOST: data01.somedomain.ru
      DB_POSTGRESDB_PORT: 5432
      DB_POSTGRESDB_USER_FILE: "/run/secrets/n8ndatabaseuser"
      DB_POSTGRESDB_PASSWORD_FILE: "/run/secrets/n8ndatabaseuserpass" 
      #External data storage
      N8N_EXTERNAL_STORAGE_S3_HOST: 
      N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME:
      N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION:
      N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY:
      N8N_EXTERNAL_STORAGE_S3_ACCESS_SECRET:                                                   # HTPASSWD_FILE can be whatever as it is not used/called anywhere.
    secrets:
      - n8ndatabaseuser
      - n8ndatabaseuserpass
    networks:
      - traefik-proxy
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      update_config:
        delay: 15s
        parallelism: 1
        monitor: 10s
        failure_action: rollback
        max_failure_ratio: 0.55
      # Container resources (replace with yours)
      resources:
        limits:
          cpus: '0.35'
          memory: 256M
        reservations:
          cpus: '0.15'
          memory: 128M 
      labels:
        # Labels for traefik https://doc.traefik.io/traefik/providers/docker/
        - "traefik.enable=true"
        - "traefik.http.routers.n8n.tls=true"
        - "traefik.http.routers.n8n.entrypoints=https"
        - "traefik.http.routers.n8n.rule=Host(`n8n.somedomain.net`)"
        # Port traefik needs to route traffic to
        - "traefik.http.routers.n8n.service=n8n"
        - "traefik.http.services.n8n.loadbalancer.server.port=5678"
        # Enable middlewares
        - "traefik.http.routers.n8n.middlewares=chain-no-auth@file" # n8n-auth@docker
        - "traefik.http.routers.n8n-api.rule=Host(`api.somedomain.net`)"
        - "traefik.http.routers.n8n-api.tls=true"
        - "traefik.http.routers.n8n-api.entrypoints=https"
        - "traefik.http.routers.n8n-api.service=n8n"

I want to use that domain https://api.somedomain.net, only for webhook endpoint. now when going to that address I can see login page for n8n editor.

How can I configure that edit is available only from n8n.somedomain.net and webook endpoint is api.somedomain.net

Any ideas how to solve this problem?

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

I have added path prefix /webhook to api.somedomain.net , so there is no route rule now for api.somedomain.net

"traefik.http.routers.n8n-api.rule=Host(`api.somedomain.net`) && PathPrefix(`/webhook`)"

Hey @Ruben_Khachaturov,

So it would come down to the routing, you would need to make sure that the webhook uri only goes to the /webhook endpoint.

Another option would be to use webhook workers and direct that traffic to those instead of the main instance.

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