Problem Description
I’m unable to connect ClickUp via OAuth in my self-hosted n8n instance (tag:latest). The setup uses Docker Compose with Traefik: s a reverse proxy and n8n’s
During OAuth authentication:
-
I enter the generated callback URL in ClickUp’s node:
https://n8n.domain.com/rest/oauth2-credential/callback
**
in clickup GUI it is being truncated to only domain part - n8n.domain.com without full path** -
ClickUp’s authorization dialog appears, but after granting access to workspace, I get:
Error: Unsupported content type: text/html Failed to connect. The window can be closed now.
- Traefik logs show no errors, but n8n logs indicate the callback returns HTML instead of expected JSON. Also same in DevTools preview in Chrome
Suspected Issue:
- Traefik middleware might be modifying headers/responses.
- ClickUp expects strict
application/json
but receives HTML (possibly a fallback error page).
My Environment
- OS: Ubuntu 22.04 LTS
- Docker: 24.0.7
- Tools:
- Traefik v2.10.7 (reverse proxy with Let’s Encrypt)
- n8n:latest
Configuration Files
docker-compose.yml
services:
traefik:
image: "traefik"
restart: always
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
- "--log.level=DEBUG"
ports:
- "80:80"
- "443:443"
volumes:
- traefik_data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=web,websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
- traefik.http.routers.n8n.middlewares=n8n-headers@docker
- traefik.http.middlewares.n8n-headers.headers.customrequestheaders.X-Forwarded-Proto=https
- traefik.http.middlewares.n8n-headers.headers.customrequestheaders.X-Forwarded-Host=n8n.blagohod.ru
- traefik.http.middlewares.n8n-headers.headers.customrequestheaders.Host=n8n.blagohod.ru
environment:
- N8N_HOST=https://${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https:///${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- N8N_LOG_LEVEL=debug
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
volumes:
n8n_data:
traefik_data:
Steps I Tried
- Verified ClickUp OAuth Settings:
Current vaules:
n8n.domain.com
n8n.domain.com:5678
Changed vars in env for n8n image
WEBHOOK_URL=https:///${SUBDOMAIN}.${DOMAIN_NAME}/ + PORT and without port
- Adjusted Traefik Middleware:
- Added headers to enforce
Content-Type: application/json
:
command: - “–experimental.http.middlewares.n8n-headers.headers.customResponseHeaders.Content-Type=application/json”
- Disabled compression:
- “–experimental.http.middlewares.n8n-no-compress.compress=false”
- n8n Environment Variables:
environment: - N8N_PROXY_CORS=true - N8N_DISABLE_PRODUCTION_MAIN_PAGE=true
Key Questions
- How can I configure Traefik to not interfere with n8n’s OAuth callbacks?
- Are there specific headers/middleware needed for ClickUp’s OAuth?
- Why does the callback return HTML instead of JSON when behind Traefik?
Any debugging tips or working Traefik+n8n examples would be appreciated!