Fluxheim/문서/Reverse Proxy

Reverse Proxy

애플리케이션 서버 앞에 Fluxheim을 둡니다. Fluxheim이 TLS, 헤더, 제한, 업스트림 선택을 처리합니다.

Basic proxy

[[vhosts]]
name = "app"
hosts = ["app.example.com"]

[[vhosts.routes]]
path_prefix = "/"
action = "proxy"
upstreams = ["127.0.0.1:3000"]

route 선택

feature사용할 때
path_exact하나의 URL에 precise route가 필요합니다.
path_prefix전체 URL subtree가 하나의 backend로 갑니다.
strip_prefixbackend가 public prefix를 보면 안 됩니다.
rewrite_prefixbackend가 다른 internal prefix를 기대합니다.
methodsroute가 선택된 HTTP method만 허용해야 합니다.

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

알려진 출처의 브라우저 애플리케이션이 이 경로를 호출해야 하는 경우에만 CORS를 활성화하세요.

[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은 유효한 프리플라이트 요청에 로컬로 응답하며, 거부된 프리플라이트는 애플리케이션에 도달하지 않고 403을 반환합니다.
  • 와일드카드 원본을 자격 증명과 결합하지 마세요.
  • CORS는 인증, 승인 또는 CSRF 보호가 아닙니다.

프로덕션 참고

  • 애플리케이션은 loopback 또는 사설 네트워크에 유지하세요.
  • 업로드를 노출하기 전에 요청 본문 제한을 설정하세요.
  • Use trusted proxy settings only for networks you control.
  • 서로 다른 path에 서로 다른 safety rule이 필요하면 하나의 큰 fallback보다 explicit route를 선호하세요.
한국어