u2b.cx/caddy/Caddyfile

1.2 KiB

{
log http.log.access {
include http.log.access
output stdout
format formatted "[{ts}] {request>remote_ip} {request>headers>X-Forwarded-For} {request>method} {request>host}{request>uri} {status} {request>headers>User-Agent} {request>headers>Referer}" {
time_format "02/Jan/2006:15:04:05-0700"
}
}
log default {
exclude http.log.access
output stderr
format console
}
}
 
{$CADDY_SITE:":80"} {
log
tls {
dns porkbun {
api_key {env.PORKBUN_API_KEY}
api_secret_key {env.PORKBUN_API_SECRET}
}
}
handle_path /proxy/* {
@gv path_regexp gvurl ^\/([a-z0-9-]+\.googlevideo\.com)
handle @gv {
uri strip_prefix /{re.gvurl.1}
reverse_proxy {
to {re.gvurl.1}:443
header_up Host {re.gvurl.1}
header_down Location "^https://(.*)" "/proxy/$1"
transport http {
tls
}
}
}
handle {
respond 403
}
}
handle {
route {
@www path / /favicon.ico
redir @www https://www.u2b.cx{uri} permanent
 
respond /robots.txt "User-agent: *
Disallow: /
"
respond /.* 403
@notget not method GET
respond @notget 403
 
reverse_proxy http://127.0.0.1:8080
}
}
}