Skip to content

fix: serve all routes at both / and /service/ via middleware#873

Merged
nimish-ks merged 4 commits into
mainfrom
fix/url-routing-service-prefix
May 7, 2026
Merged

fix: serve all routes at both / and /service/ via middleware#873
nimish-ks merged 4 commits into
mainfrom
fix/url-routing-service-prefix

Conversation

@nimish-ks
Copy link
Copy Markdown
Member

@nimish-ks nimish-ks commented May 5, 2026

Summary

Adds a small middleware that strips a /service URL prefix before URL resolution, so every backend route resolves at both /<path> and /service/<path> with no per-route registration.

Refactors public_urls to be defined without a prefix and mounts it at root first (so reverse() 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

  • Manually verified locally that routes resolve at both prefixes
  • Existing self-hosted topology (nginx strips /service/ before proxying to backend) continues to work unchanged
  • Unit tests for the routing behavior

…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.
@nimish-ks nimish-ks requested a review from rohan-chaturvedi May 6, 2026 06:43
@nimish-ks nimish-ks self-assigned this May 6, 2026
Copy link
Copy Markdown
Member

@rohan-chaturvedi rohan-chaturvedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nimish-ks nimish-ks merged commit 9fdf39c into main May 7, 2026
15 checks passed
@nimish-ks nimish-ks deleted the fix/url-routing-service-prefix branch May 7, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants