restreamer-ui-v2/Caddyfile

60 lines
1.5 KiB
Caddyfile

:3000
encode zstd gzip
# ── Facebook OAuth2 microserver (Node.js en puerto 3002) ──────────────────────
handle /fb-server/* {
uri strip_prefix /fb-server
reverse_proxy localhost:3002
}
# ── yt-dlp stream extractor (servicio externo configurable via env) ───────────
# /yt-stream/{VIDEO_ID} → http://YTDLP_HOST/stream/{VIDEO_ID}
# yt-dlp puede tardar 20-30s — timeouts extendidos a 120s
handle_path /yt-stream/* {
rewrite * /stream{path}
reverse_proxy {env.YTDLP_HOST} {
transport http {
dial_timeout 10s
response_header_timeout 120s
read_timeout 120s
}
}
}
# OAuth2 callback page — must be served as a static HTML (not the SPA index)
handle /oauth2callback {
rewrite * /oauth2callback.html
file_server {
root /ui/build
}
}
# Facebook OAuth2 callback popup — soporta tanto .html como .htm
# .html → servir directamente
handle /oauth/facebook/callback.html {
file_server {
root /ui/build
}
}
# .htm → reescribir internamente a .html (misma página, misma URL visible para Facebook)
handle /oauth/facebook/callback.htm {
rewrite * /oauth/facebook/callback.html
file_server {
root /ui/build
}
}
# Sin extensión → redirigir a .html
handle /oauth/facebook/callback {
redir /oauth/facebook/callback.html{query} 302
}
# SPA — serve static files, fallback to index.html for client-side routing
handle {
root * /ui/build
try_files {path} /index.html
file_server
}