docs: relax Caddy routing to allow LiteLLM UI backend API calls

This commit is contained in:
Haitao Pan 2026-06-12 09:36:03 +08:00
parent e3952916af
commit e9dec70225

View File

@ -2,71 +2,24 @@
encode zstd gzip
# ------------------------------------------------------------------------
# Model Registry
# GET /v1/models
# OpenAI/Anthropic Path Compatibility Rewrites
# ------------------------------------------------------------------------
handle /v1/models {
reverse_proxy {{ litellm_listen_host }}:{{ litellm_listen_port }} {
flush_interval -1
}
}
rewrite /v1/openai/chat/completions /v1/chat/completions
rewrite /v1/openai/embeddings /v1/embeddings
rewrite /v1/anthropic/messages /v1/messages
# ------------------------------------------------------------------------
# OpenAI-Compatible Endpoints
# Proxy ALL requests to LiteLLM Backend
# ------------------------------------------------------------------------
handle_path /v1/openai/chat/completions {
rewrite * /v1/chat/completions
reverse_proxy {{ litellm_listen_host }}:{{ litellm_listen_port }} {
flush_interval -1
transport http {
dial_timeout 30s
read_timeout 600s
write_timeout 600s
}
reverse_proxy {{ litellm_listen_host }}:{{ litellm_listen_port }} {
flush_interval -1
transport http {
dial_timeout 30s
read_timeout 600s
write_timeout 600s
}
}
handle_path /v1/openai/embeddings {
rewrite * /v1/embeddings
reverse_proxy {{ litellm_listen_host }}:{{ litellm_listen_port }} {
flush_interval -1
transport http {
dial_timeout 30s
read_timeout 600s
write_timeout 600s
}
}
}
# ------------------------------------------------------------------------
# Anthropic-Compatible Endpoint
# ------------------------------------------------------------------------
handle_path /v1/anthropic/messages {
rewrite * /v1/messages
reverse_proxy {{ litellm_listen_host }}:{{ litellm_listen_port }} {
flush_interval -1
transport http {
dial_timeout 30s
read_timeout 600s
write_timeout 600s
}
}
}
# ------------------------------------------------------------------------
# Admin UI
# ------------------------------------------------------------------------
handle /ui* {
reverse_proxy {{ litellm_listen_host }}:{{ litellm_listen_port }} {
flush_interval -1
}
}
# Catch-all: block unknown paths
handle {
respond "Not Found" 404
}
log {
output file /var/log/caddy/{{ litellm_api_domain }}.access.log
}