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_exact1つのURLにprecise routeが必要な場合。
path_prefixURL subtree全体を1つのbackendへ送る場合。
strip_prefixbackendにpublic prefixを見せたくない場合。
rewrite_prefixbackendが別のinternal prefixを期待する場合。
methodsrouteが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を優先します。
日本語