Files
diary-news/Caddyfile

40 lines
794 B
Caddyfile
Raw Normal View History

{
# 全局选项
auto_https off
admin off
log {
level info
output stdout
}
}
# 如果 DOMAIN 为空,直接走 80 端口 HTTP(自签证书后面再补)
# 如果有域名,改用下面的 https 配置块
http://{$DOMAIN:NEWS_DOMAIN_FALLBACK} {
# /api/* 转发到 api:8000,handle_path 会自动 strip 匹配的 /api 前缀
handle_path /api/* {
reverse_proxy api:8000
}
# 其余走前端 SPA
handle {
reverse_proxy frontend:80
}
encode gzip zstd
# 日志
log {
output stdout
format console
}
}
# 如果有域名,启用自动 HTTPS(取消下面注释,并把上面块注释)
# {$DOMAIN} {
# reverse_proxy /api/* api:8000
# reverse_proxy /* frontend:80
# encode gzip zstd
# }