Reverse Proxy
Fluxheimをapplication serverの前に置きます。FluxheimがTLS、headers、limits、upstream selectionを処理します。
Basic proxy
[[vhosts]]
name = "app"
hosts = ["app.example.com"]
[[vhosts.routes]]
path_prefix = "/"
action = "proxy"
upstreams = ["127.0.0.1:3000"]
route choices
| feature | 使う場面 |
|---|---|
path_exact | 1つのURLにprecise routeが必要な場合。 |
path_prefix | URL subtree全体を1つのbackendへ送る場合。 |
strip_prefix | backendにpublic prefixを見せたくない場合。 |
rewrite_prefix | backendが別のinternal prefixを期待する場合。 |
methods | routeがselected HTTP methodsだけを受け付けるべき場合。 |
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
production notes
- applicationはloopbackまたはprivate networkに置きます。
- uploadsを公開する前にrequest body limitsを設定します。
- Use trusted proxy settings only for networks you control.
- 異なるpathsに異なるsafety rulesが必要な場合、大きなfallback 1つよりexplicit routesを優先します。