GameServerWeb.Plugs.SecurityHeaders (game_server_web v1.0.935)

Copy Markdown

Sets baseline security headers on every response.

These headers apply to all requests — static assets, API endpoints, and browser pages alike. Router-level pipelines may override individual headers (e.g. Content-Security-Policy) for specific scopes.

Headers set:

HeaderValuePurpose
X-Content-Type-OptionsnosniffPrevents MIME type sniffing
X-Frame-OptionsSAMEORIGINPrevents clickjacking
Referrer-Policystrict-origin-when-cross-originLimits referrer leakage
Permissions-Policy(restrictive)Limits browser feature access
Cross-Origin-Resource-Policysame-originPrevents cross-origin embedding
X-Permitted-Cross-Domain-PoliciesnonePrevents Flash/PDF cross-domain

In production, the x-request-id response header is stripped to avoid leaking internal correlation identifiers. The request ID remains available in conn.assigns[:request_id] for logging.