Reverse Proxy
Metti Fluxheim davanti a un application server. Fluxheim gestise TLS, header, limiti e selezione upstream.
Basic proxy
[[vhosts]]
name = "app"
hosts = ["app.example.com"]
[[vhosts.routes]]
path_prefix = "/"
action = "proxy"
upstreams = ["127.0.0.1:3000"]
Scelte route
| Funzione | Usalo coando |
|---|---|
path_exact | Un URL richiede na route precisa. |
path_prefix | Un intero sottoalbero URL va a un backend. |
strip_prefix | Il backend no deve vedere el prefisso pubblico. |
rewrite_prefix | Il backend si aspetta un prefisso interno diverso. |
methods | Una route deve accettare solo metodi HTTP selezionati. |
Esempio path rewrite
[[vhosts.routes]]
name = "api"
path_prefix = "/api/"
strip_prefix = "/api/"
rewrite_prefix = "/internal/"
[vhosts.routes.proxy]
upstreams = ["10.0.0.20:8080"]
connect_timeout_secs = 5
read_timeout_secs = 30
send_timeout_secs = 30
CORS par łe app del browser
Abilita CORS soło co łe app del browser su origini conosùe łe ga da ciamar sta route.
[headers.cors]
enabled = true
allow_origins = ["https://app.example.com"]
allow_methods = ["GET", "HEAD", "POST"]
allow_headers = ["authorization", "content-type"]
allow_credentials = true
max_age_secs = 600
- Fluxheim el responde localmente a łe richieste preflight vàłide; i preflight refudà i torna
403sensa rivar a l'aplicazion. - No combinar na origine wildcard co łe credenziałi.
- CORS no xe autenticazion, autorizazion o protezion CSRF.
Note production
- Tegnì l'applicazione su loopback o su na rete privata.
- Imposta limiti al body de łe request prima de esporre upload.
- Use trusted proxy settings only for networks you control.
- Preferisci route esplicite a un grande fallback coando path diversi richiedono regole de seguresa diverse.