AnyBot/relay/Caddyfile

31 lines
1.2 KiB
Caddyfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Caddy gets and renews the HTTPS certificate by itself.
# Replace anybot.example.com with your own domain (its DNS must point to this server).
anybot.example.com {
encode gzip
# Browsers keep to https here; nothing guesses a file's type; no page frames this one.
header {
Strict-Transport-Security "max-age=31536000"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
Referrer-Policy "no-referrer"
}
# No request body larger than a backup (the relay has its own, smaller limits per path).
request_body {
max_size 210MB
}
# The 大腦管理員 API is for this server's own manager, inside (deploy/server: brains).
respond /relay/manager/* 404
reverse_proxy relay:8080 {
# Who asked, believed only from here (ANYBOT_PROXY_SECRET in .env; a cloud brain
# talking to the account server straight can't send it).
header_up X-AnyBot-Proxy {$ANYBOT_PROXY_SECRET}
# The phone's "anything new?" request waits up to 35 s. Each AnyBot also keeps one
# WebSocket open here (pinged every 15–20 s, so it never sits idle for 60 s).
transport http {
read_timeout 620s
}
# Reloading this file doesn't cut those connections at once.
stream_close_delay 5m
}
}