I am trying to pass a host environment variable to HTTP Node in n8n.
It works fine for Webhook nodes, and also for HTTP Node (GET request).
But on POST request, it fails with Invalid URL
.
Setup:
.env
:
HH_NINJA_URL=http://172.18.0.100:8000
docker-compose.yml
:
n8n:
restart: always
image: n8nio/n8n:1.86.1
container_name: n8n
environment:
WEBHOOK_URL: https://webhook.url.com/
HH_NINJA_URL: ${HH_NINJA_URL}
N8N_LISTEN_ADDRESS: 0.0.0.0
N8N_TRUST_PROXY: true
N8N_BASIC_AUTH_ACTIVE: true
N8N_PERSONALIZATION_ENABLED: true
N8N_USER_MANAGEMENT_DISABLED: false
N8N_DEFAULT_LOCALE: en
DB_TYPE: sqlite
DB_SQLITE_FILE: /home/node/.n8n/database.sqlite
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: true
N8N_RUNNERS_ENABLED: true
volumes:
- n8n_data:/home/node/.n8n
- ./n8n/prompts:/home/node/prompts
networks:
- external_network
Inside n8n container check:
printenv | grep HH
# HH_NINJA_URL=http://172.18.0.100:8000
curl -X GET ${HH_NINJA_URL}/api/v1/ai-llm/internal/resumes/5
# {"user_id":5,"resumes":[...]} âś…
curl -X POST ${HH_NINJA_URL}/api/v1/ai-llm/internal/assistant -H "Content-Type: application/json" -d '{"user_id": 5, "assistant_id": 777}'
# {"success":true,...} âś…
In n8n:
- First HTTP Node (GET): works
- Second HTTP Node (POST): fails with "Invalid URL"
Question
Why does it work inconsistently between HTTP nodes (GET vs POST) even though the environment variable is correctly defined and available?
n8n community edition 1.86.1