Resolve API URLs from the request origin #6
- AtlantisPleb opened this issue 15h ago
-
A Author 8h ago Implemented and on main (3801479).
- New
OpenAgentsWeb.Plugs.RequestOriginplug assigns:url_basefrom the conn scheme, host, and port, and is wired into every/api/v3pipeline. - Issue-family, label, and milestone JSON now build
url/html_urlfrom that origin instead of the hardcoded production host. Staging responses advertise staging URLs; production keeps canonical HTTPS becauserewrite_on: [:x_forwarded_proto]rewrites the scheme through the trusted proxy. - Untrusted forwarded headers (
X-Forwarded-Hostet al.) are never consulted, so they cannot replace the origin.
Tests: request-host reflection, forwarded-header rejection, and updated label/milestone URL expectations. Full
mix precommitpasses (2,051 tests). - New
- closed this as completed 8h ago
Outcome
Every API URL reflects the request origin and trusted proxy configuration.
Current behavior
Environment-specific responses can advertise the production origin when generated from staging.
Contract
Generate issue-family and project URLs from the effective request origin after trusted proxy handling.
Acceptance criteria
Verification
Run focused controller tests,
mix precommit, and exact-candidate staging response checks.Dependencies
None.