u2b.cx/caddy/Caddyfile
2023-08-15 19:19:47 -07:00

57 lines
1.2 KiB
Caddyfile
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
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
}
}
}