We2.ee/caddy/Caddyfile
2025-01-20 17:46:05 +00:00

124 lines
No EOL
3 KiB
Caddyfile

# Matrix (Conduwuit)
we2.ee {
# About redirect
handle /about {
redir https://sij.law/we2ee/ permanent
}
# Privacy Policy redirect
handle /privacy {
redir https://sij.law/we2ee-privacy/ permanent
}
# Terms redirect
handle /terms {
redir https://sij.law/we2ee-terms/ permanent
}
# Anysync redirect
handle /anysync {
redir https://sij.law/anysync/ permanent
}
# Handle Matrix-style room redirects (MUST come before user redirects!)
@matrix_local_room {
path_regexp ^/@@([^:]+)$
}
redir @matrix_local_room https://matrix.to/#/%23{re.1}:we2.ee permanent
# Handle Matrix-style room redirects with custom domains
@matrix_remote_room {
path_regexp ^/@@([^:]+):([^/]+)$
}
redir @matrix_remote_room https://matrix.to/#/%23{re.1}:{re.2} permanent
# Handle Matrix-style user redirects
@matrix_local_user {
path_regexp ^/@([^:]+)$
}
redir @matrix_local_user https://matrix.to/#/@{re.1}:we2.ee permanent
# Handle Matrix-style user redirects with custom domains
@matrix_remote_user {
path_regexp ^/@([^:]+):([^/]+)$
}
redir @matrix_remote_user https://matrix.to/#/@{re.1}:{re.2} permanent
# Handle Conduwuit homeserver
handle /_matrix/* {
reverse_proxy localhost:8448
}
# Handle federation
handle /.well-known/matrix/server {
header Access-Control-Allow-Origin "*"
header Content-Type "application/json"
respond `{"m.server": "we2.ee"}`
}
# Handle client discovery
handle /.well-known/matrix/client {
header Access-Control-Allow-Origin "*"
header Content-Type "application/json"
respond `{
"m.homeserver": {"base_url": "https://we2.ee"},
"org.matrix.msc3575.proxy": {"url": "https://we2.ee"}
}`
}
# Handle MSC1929 Admin Contact Information
handle /.well-known/matrix/support {
header Access-Control-Allow-Origin "*"
header Content-Type "application/json"
respond `{
"contacts": [
{
"matrix_id": "@sij:we2.ee",
"email_address": "sij@sij.law",
"role": "m.role.admin"
}
],
"support_page": "https://we2.ee/about"
}`
}
# Handle Element webUI
handle {
reverse_proxy localhost:8637
}
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
}
# Anytype Sync
sync.we2.ee {
# Tree nodes
handle_path /tree/* {
reverse_proxy 127.0.0.1:1001 127.0.0.1:1002 127.0.0.1:1003
}
# Coordinator
handle_path /coordinator/* {
reverse_proxy 127.0.0.1:1004
}
# File node
handle_path /file/* {
reverse_proxy 127.0.0.1:1005
}
# Consensus node
handle_path /consensus/* {
reverse_proxy 127.0.0.1:1006
}
}
# PrivateBin
txt.we2.ee {
reverse_proxy localhost:8987
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
}