This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/docker/caddy/Caddyfile

102 lines
2.4 KiB
Caddyfile

(webserver) {
root * /home/user/public_html
file_server
encode zstd gzip
@skylink {
path_regexp skylink ^/([a-zA-Z0-9-_]{46}(/.*)?)$
}
@skylink_file {
path_regexp skylink_file ^/file/([a-zA-Z0-9-_]{46}(/.*)?)$
}
@options {
method OPTIONS
}
@blacklist {
method GET
path /blacklist
}
@portals {
method GET
path /portals
}
# OPTIONS headers to allow CORS https://enable-cors.org
handle @options {
header {
Access-Control-Allow-Origin *
Access-Control-Allow-Methods GET,POST,OPTIONS
Access-Control-Allow-Headers DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range
Access-Control-Max-Age 1728000
}
respond 204
}
reverse_proxy /health-check health-check:3100
reverse_proxy @blacklist nginx:80 {
header_up User-Agent Sia-Agent
header_down Access-Control-Allow-Origin *
}
reverse_proxy @portals nginx:80 {
header_up User-Agent Sia-Agent
header_down Access-Control-Allow-Origin *
}
reverse_proxy /stats nginx:80 {
header_up User-Agent Sia-Agent
header_down Access-Control-Allow-Origin *
}
reverse_proxy /statsdown nginx:80 {
header_up User-Agent Sia-Agent
header_down Access-Control-Allow-Origin *
}
reverse_proxy @skylink nginx:80 {
header_up User-Agent Sia-Agent
header_up Access-Control-Expose-Headers skynet-file-metadata
header_down Access-Control-Allow-Origin *
}
reverse_proxy @skylink_file nginx:80 {
header_up User-Agent Sia-Agent
header_up Access-Control-Expose-Headers skynet-file-metadata
header_down Access-Control-Allow-Origin *
}
reverse_proxy /skynet/skyfile* nginx:80 {
header_up User-Agent Sia-Agent
header_up Authorization "Basic {env.SIA_API_AUTHORIZATION}"
header_down Access-Control-Allow-Origin *
}
}
(custom.domain) {
{$DOMAIN_NAME} {
tls {$EMAIL_ADDRESS}
import webserver
}
}
(siasky.net) {
siasky.net, *.siasky.net {
tls {
dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
}
import webserver
}
}
(localhost) {
:443 {
tls internal {
on_demand
}
import webserver
}
}
import localhost
import custom.domain
# import siasky.net