GameServerWeb.Plugs.DynamicCors (game_server_web v1.0.943)

Copy Markdown

Runtime CORS plug that delegates to Corsica using values read from application environment at startup. This allows PHX_ALLOWED_ORIGINS to be configured at runtime (via config/runtime.exs).

The Corsica options are compiled once on first request and cached in a persistent_term for near-zero overhead on subsequent requests.

Summary

Functions

Invalidate the cached Corsica options. Call this if CORS origins are changed at runtime (e.g. via admin config).

Functions

call(conn, opts)

init(opts)

invalidate_cache()

Invalidate the cached Corsica options. Call this if CORS origins are changed at runtime (e.g. via admin config).