Skip to content

fix(nginx): stop stripping the /api/ prefix on proxy_pass#30

Merged
obrien-k merged 1 commit into
orphic-inc:mainfrom
obrien-k:fix/nginx-api-prefix
Jul 13, 2026
Merged

fix(nginx): stop stripping the /api/ prefix on proxy_pass#30
obrien-k merged 1 commit into
orphic-inc:mainfrom
obrien-k:fix/nginx-api-prefix

Conversation

@obrien-k

Copy link
Copy Markdown
Member

Summary

Both proxy.nginx.conf and proxy-tls.nginx.conf proxy_pass to the api backend with a trailing slash on the URL (proxy_pass http://api:8080/;). In nginx, that rewrites away the matched location /api/ prefix before forwarding — so a request to /api/auth/login reaches the backend as /auth/login.

api mounts every route under /api/* internally:

src/app.ts:144:  app.use('/api/auth', authRouter);
src/app.ts:145:  app.use('/api/users', userRouter);
... (all routes, confirmed at the v0.7.0 tag currently pinned in docker-compose.yml)

So as currently pinned, every request through this proxy config would 404 against the real api routes — nginx needs to forward the full /api/... path unchanged.

Change

Drop the trailing slash on both proxy_pass directives so the full request URI is forwarded as-is.

Test plan

  • Confirmed api's route mounting at the v0.7.0 tag via git grep "app.use('/api" — all routers expect the /api/ prefix
  • Smoke-test end-to-end against a running stack (not yet done here — static analysis only)

🤖 Generated with Claude Code

api mounts every route under /api/* internally (src/app.ts:
app.use('/api/auth', ...), app.use('/api/users', ...), etc. — confirmed
against the v0.7.0 tag currently pinned in docker-compose.yml). The
trailing slash on proxy_pass rewrites the location's matched prefix away
before forwarding, so nginx was sending e.g. /auth/login to the backend
instead of /api/auth/login — every API route would 404 behind this
config as currently pinned.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@obrien-k
obrien-k merged commit a935cca into orphic-inc:main Jul 13, 2026
2 checks passed
@obrien-k
obrien-k deleted the fix/nginx-api-prefix branch July 13, 2026 04:48
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