Skip to content

fix(proxy): route the trailing-slash root of proxied subpaths (SHD-1087) - #34

Merged
janosmurai merged 1 commit into
mainfrom
SHD-1087/app-trailing-slash
Oct 19, 2026
Merged

janosmurai merged 1 commit into
mainfrom
SHD-1087/app-trailing-slash

Conversation

@janosmurai

@janosmurai janosmurai commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • New feature
  • Bug fix
  • Breaking change
  • Refactoring or maintenance
  • Documentation update

Related issue

Closes SHD-1087

Description

With WEBAPP_URL set, /app/ returned the server's own route_not_found 404, while /app, /app/index.html and the assets were proxied correctly. The web app is built with base path /app/, so /app/ is its canonical URL.

ReverseProxy mounts itself with Router::nest(path, ...). In axum 0.8, nest matches path and path/{*rest}, and a catch-all never matches an empty remainder, so path/ fell through to fallback_404. /control-panel/ had the same gap.

The new routes::proxy::subpath_proxy mounts the proxy as before and also routes path/ to it with route_service. Both /app and /control-panel now use it. The proxy strips its own base path, so /app/ reaches the upstream as /, the same as /app.

Validation

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --verbose --all-features
  • cargo test --verbose --all-features

Additional validation details:

  • Ran just check, which covers the four checks above.
  • New tests in routes/proxy.rs run the router against a real upstream server that echoes the path it received. /app, /app/, /app/index.html and /app/assets/index.js?v=1 should reach the upstream as /, /, /index.html and /assets/index.js?v=1. /, /application and /v1/models should not be proxied.
  • With the new /app/ route removed, the test fails at /app/ with (404, ""), which reproduces the bug.

Deployment and compatibility

None. No configuration or API changes. /app/ and /control-panel/ now reach their upstream instead of returning 404.

Documentation

None needed. This makes the documented /app proxy behave as expected.

Checklist

  • I added or updated tests for changed behavior, or explained why tests are not needed.
  • I updated user-facing and API documentation where necessary.
  • My commits follow the Conventional Commits specification.
  • Every commit includes a Signed-off-by trailer (git commit -s).

AI assistance:

  • Tool: Claude Code
  • Model: Claude Opus 5.5
  • Used for: root-cause analysis in axum-reverse-proxy, the fix, the tests and this description
  • Human verification: done

@janosmurai
janosmurai requested a review from gaboraxem as a code owner October 18, 2026 17:39
Signed-off-by: janosmurai <janos.murai@axem.dev>
@janosmurai
janosmurai force-pushed the SHD-1087/app-trailing-slash branch from 266c2fb to 5ff5b16 Compare October 19, 2026 12:03
@janosmurai
janosmurai merged commit 2254e55 into main Oct 19, 2026
1 check passed
@janosmurai
janosmurai deleted the SHD-1087/app-trailing-slash branch October 19, 2026 12:09
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.

1 participant