Reverse Proxy
Setz Fluxheim vor an Anwendungsserver. Fluxheim übernimmt TLS, Header, Limits und d Upstream-Auswahl.
Basic proxy
[[vhosts]]
name = "app"
hosts = ["app.example.com"]
[[vhosts.routes]]
path_prefix = "/"
action = "proxy"
upstreams = ["127.0.0.1:3000"]
Routenauswahl
| Feature-Bereich | Nutz es, wenn |
|---|---|
path_exact | A URL braucht a präzise Route. |
path_prefix | A ganzer URL-Unterbaum geht an a Backend. |
strip_prefix | S Backend soi den öffentlichen Prefix ned segn. |
rewrite_prefix | S Backend erwartet an andern internen Prefix. |
methods | A Route soi bloß ausgewählte HTTP-Methoden akzeptiern. |
Beispiel fur Pfad-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 fia Browser-Apps
Schalt CORS bloß ei, wenn Browser-Apps vo bekannten Ursprüngen de Route aufruafa miassn.
[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 beantwortet gültige Preflight-Anfragen lokal; abglehnte Preflights gebn
403zruck, ohne de Anwendung z erreicha. - Kombinier koan Wildcard-Ursprung mit Anmeldedatn.
- CORS is koa Authentifizierung, Autorisierung oder CSRF-Schutz.
Produktionshinweise
- Hoib d Anwendung auf Loopback oder in am privaten Netzwerk.
- Setz Request-Body-Limits, bevorst Uploads freigibst.
- Use trusted proxy settings only for networks you control.
- Nimm explizite Routen statt am großen Fallback, wenn Pfade unterschiedliche Sicherheitsregeln brauchn.