Gale.PhoenixAdapter (Gale v0.1.1)

Copy Markdown View Source

Phoenix endpoint adapter: HTTP/1.1 + HTTP/2 (Bandit) and HTTP/3 (QUIC).

Drop-in for Bandit.PhoenixAdapter. Phoenix 1.7+ LiveView websockets keep working on Bandit. HTTP/3 is extra, on UDP.

# config/config.exs
config :my_app, MyAppWeb.Endpoint,
  adapter: Gale.PhoenixAdapter

# config/runtime.exs (prod)
config :my_app, MyAppWeb.Endpoint,
  https: [
    port: 443,
    certfile: System.fetch_env!("SSL_CERT_PATH"),
    keyfile: System.fetch_env!("SSL_KEY_PATH")
  ],
  http3: [
    port: 443,
    certfile: System.fetch_env!("SSL_CERT_PATH"),
    keyfile: System.fetch_env!("SSL_KEY_PATH")
  ]

:http3 may be true (reuse https certs and port), a keyword list, or omitted. Responses on H1/H2 include alt-svc so browsers upgrade to H3.

Summary

Functions

Bandit process under the Gale supervisor (H1/H2).

Gale server supervisor for scheme (:http or :https) on the endpoint.

HTTP/3 listener pid, if started.

Bound TCP address/port of the Bandit listener (Phoenix uses this).

Functions

bandit_pid(endpoint, scheme \\ :http)

Bandit process under the Gale supervisor (H1/H2).

gale_pid(endpoint, scheme \\ :http)

Gale server supervisor for scheme (:http or :https) on the endpoint.

http3_pid(endpoint, scheme \\ :https)

HTTP/3 listener pid, if started.

server_info(endpoint, scheme)

Bound TCP address/port of the Bandit listener (Phoenix uses this).