We’re encountering a 404 Not Found error from the HuggingFace Inference endpoint when the request includes the X-Forwarded-Host header.
The issue appears to stem from the presence of this header, even if we use any private/public domain:
X-Forwarded-Host: google.com
Without Header – Works
When this header is removed, the request succeeds.
Identical payloads and endpoints return valid responses when the header is omitted.
With Header – Fails
If included (even with a valid public domain), the request fails with:
{
"error": "Not Found: google.com"
}
You can use curl command to replicate this issue
curl "https://{your-inference-endpoint}/v1/chat/completions" \
-X POST \
-H "Authorization: Bearer <HF_TOKEN>" \
-H "Content-Type: application/json" \
-H "X-Forwarded-Host: any-domain.com" \
-d '{
"model": "unsloth/DeepSeek-R1-GGUF",
"messages": [{"role": "user", "content": "What is deep learning?"}],
"max_tokens": 150
}'
Please let us know if there’s a workaround or config option available to suppress this behavior.