Skip to content

fix: match API routes under server base URL - #2218

Merged
birkskyum merged 2 commits into
mainfrom
fix/api-routes-base-url
Jul 20, 2026
Merged

birkskyum merged 2 commits into
mainfrom
fix/api-routes-base-url

Conversation

@brenelz

@brenelz brenelz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • expose server.baseURL to the server handler
  • strip the configured base path before matching API and server-function routes
  • preserve BASE_URL as a fallback and avoid partial path-segment matches
  • add regression coverage and a patch changeset

Closes #2106.

Testing

  • pnpm test:ci (69 tests)
  • pnpm typecheck
  • pnpm build
  • pnpm oxfmt --check packages/start/src/config/index.ts packages/start/src/env.d.ts packages/start/src/server/handler.ts packages/start/src/server/strip-path-base.ts packages/start/src/server/strip-path-base.spec.ts .changeset/tidy-zebras-route.md

@netlify

netlify Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 7acd3ab
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a5e2459798acc0008e178b6
😎 Deploy Preview https://deploy-preview-2218--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7acd3ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2218

commit: 7acd3ab

@birkskyum
birkskyum merged commit cd98e7d into main Jul 20, 2026
10 checks passed
@birkskyum
birkskyum deleted the fix/api-routes-base-url branch July 20, 2026 16:27
@indeyets indeyets mentioned this pull request Sep 11, 2026
1 of 2 tasks
indeyets added a commit to indeyets/solid-start that referenced this pull request Sep 23, 2026
Vite accepts `base: "https://cdn…/"` for CDN hosting, and server
functions used it as the app origin. An external base says where the
assets are and nothing about the app, so the app stays at the root, in
dev as well: Vite reduces such a base to its path there, and 2.0.5
happened to mount the app under it.

`SERVER_BASE_URL` has named the app base since solidjs#2218, but only API
route matching read it, and only when `server.baseURL` was set.
huseeiin pushed a commit to huseeiin/solid-start that referenced this pull request Sep 24, 2026
Co-authored-by: Birk Skyum <74932975+birkskyum@users.noreply.github.com>
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.

[Bug?]: API routes not matched when server.baseURL is set

2 participants