I want to share my Caddy Config for adding it into the Repo.
This Config works only with Websocket-Configuration!


/etc/caddy/Caddyfile
vpn.example.com {
encode gzip
# TLS 1.3 mandatory!
tls {
protocols tls1.3
}
# Protect your GUI with Basic Auth
route /admin* {
basic_auth {
admin ******
}
reverse_proxy xx.xx.xx.xx:2053
}
# Obfuscate the Endpoint
route /api/v1* {
@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @websockets xx.xx.xx.xx:54321
respond "Forbidden" 403
}
# Security Header
header {
header_up Authorization { >Authorization }
header_up Content-Type { >Content-Type }
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Content-Type-Options nosniff
X-Frame-Options SAMEORIGIN
Referrer-Policy strict-origin-when-cross-origin
-Server
-X-Powered-By
}
# Fallback
respond "Not found!" 404
}
Describe the solution you'd like
What is happening here?
- Requesting
vpn.example.com will end up in 404 Not found
- The GUI-Portal (Basic Auth protected) is available with
vpn.example.com/admin
- The Endpoint is obfuscated with
vpn.example.com/api/v1
- Only Websocket-Connection are allowed. All other requests ends up in
403 Forbidden
Describe alternatives you've considered
No response
Checklist
I want to share my Caddy Config for adding it into the Repo.
This Config works only with Websocket-Configuration!
/etc/caddy/CaddyfileDescribe the solution you'd like
What is happening here?
vpn.example.comwill end up in404 Not foundvpn.example.com/adminvpn.example.com/api/v1403 ForbiddenDescribe alternatives you've considered
No response
Checklist