57 lines
1.2 KiB
Caddyfile
57 lines
1.2 KiB
Caddyfile
{
|
||
log http.log.access {
|
||
include http.log.access
|
||
output stdout
|
||
format formatted "[35m[{ts}][0m [96m[1m{request>remote_ip}[0m [31m{request>headers>X-Forwarded-For}[0m [33m{request>method}[0m [92m{request>host}[32m{request>uri}[0m [97m{status}[0m [90m{request>headers>User-Agent}[0m [34m{request>headers>Referer}[0m" {
|
||
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
|
||
}
|
||
}
|
||
}
|