fix: serve all routes at both / and /service/ via middleware#873
Merged
Conversation
…ddleware Cloud ALB forwards console.phase.dev/service/* to the backend verbatim, while self-hosted nginx strips /service/ before proxying. Adding a small middleware that strips the /service prefix means every route — current and future — resolves at both prefixes with no per-route registration. Refactors public_urls to be defined without a prefix and mounts it at root first (cloud canonical: api.phase.dev/v1/...) so reverse() returns the canonical form, then at /public/ for legacy clients and self-hosted nginx topologies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a small middleware that strips a
/serviceURL prefix before URL resolution, so every backend route resolves at both/<path>and/service/<path>with no per-route registration.Refactors
public_urlsto be defined without a prefix and mounts it at root first (soreverse()returns the canonical form) and at/public/for backwards compatibility with existing self-hosted topologies.Supersedes #820. CI changes from that PR landed separately in #868.
Test plan
/service/before proxying to backend) continues to work unchanged