-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Public API endpoints return "Invalid URL" while openapi.yml and UI endpoints work #27937
Description
Bug description
On a self-hosted n8n instance, every tested Public API endpoint under /api/v1/* returns:
{"message":"Invalid URL"}At the same time:
/api/v1/openapi.ymlreturns successfully/healthzreturns successfully- UI/internal endpoints like
/rest/settingsreturn successfully
This makes the Public API unusable for tools like n8n-mcp, even though the instance itself is reachable and the OpenAPI spec is served correctly.
To reproduce
Environment is self-hosted behind reverse proxy. Public host has been redacted below.
Example requests:
curl -i -H "X-N8N-API-KEY: <redacted>" "http://172.16.x.x:5678/api/v1/workflows?limit=3"
curl -i -H "X-N8N-API-KEY: <redacted>" "http://172.16.x.x:5678/api/v1/projects"
curl -i -H "X-N8N-API-KEY: <redacted>" "http://172.16.x.x:5678/api/v1/users"All of the above return:
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
{"message":"Invalid URL"}But these succeed:
curl -i "http://172.16.x.x:5678/healthz"
curl -i "http://172.16.x.x:5678/rest/settings"
curl -i "http://172.16.x.x:5678/api/v1/openapi.yml"Expected behavior
Public API endpoints such as /api/v1/workflows, /api/v1/projects, /api/v1/users, etc. should return valid JSON responses instead of 400 Invalid URL.
Observed behavior
GET /api/v1/openapi.yml-> 200 OKGET /healthz-> 200 OKGET /rest/settings-> 200 OK- All tested
GET /api/v1/*resource endpoints -> 400{\"message\":\"Invalid URL\"}
n8n setup
Self-hosted with env vars along these lines:
N8N_HOST=n8n.example.com
N8N_PROTOCOL=https
N8N_PORT=5678
WEBHOOK_URL=https://n8n.example.com/
N8N_EDITOR_BASE_URL=https://n8n.example.com
N8N_PROXY_HOPS=1Also tested direct internal access by IP (http://172.16.x.x:5678) to bypass CDN / external proxy behavior. Same result.
Additional context
This does not appear to be caused by Cloudflare/CDN or the external reverse proxy, because reproducing directly against the internal IP shows the same behavior.
It also does not seem limited to the workflows route. The same Invalid URL response happens for multiple Public API resources.
If useful, I can provide sanitized logs from the main n8n container.