Skip to content

fix(server): serve the page for HEAD when the GET handler returns nothing - #2376

Merged
lxsmnsyc merged 1 commit into
solidjs:mainfrom
RaphaelFakhri:fix/head-page-fallthrough
Nov 4, 2026
Merged

lxsmnsyc merged 1 commit into
solidjs:mainfrom
RaphaelFakhri:fix/head-page-fallthrough

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

What is the current behavior?

A route file that exports a page and a GET handler falls through to the page when GET returns nothing. A HEAD request runs the same GET handler, but the server only allows the fall-through for GET, so HEAD throws "API handler for HEAD ... did not return a response." and answers 500.

With the [...404].tsx in apps/tests, HEAD /no-such-page returns 500 while GET /no-such-page returns the 404 page.

What is the new behavior?

HEAD falls through the same way GET does, so it gets the same status and headers as the matching GET. Other methods still throw when their handler returns nothing.

The new e2e test in apps/tests/src/e2e/api-call.test.ts sends GET and HEAD to an unmatched URL and checks that both return 404 with the same content type. It fails on main (Expected: 404, Received: 500) and passes with this change.

Other information

The 1.x branch has the same check in packages/start/src/server/handler.ts and needs the same one-line change.

@changeset-bot

changeset-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b96fccb

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

@netlify

netlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit b96fccb
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6aea0a8b1d0a5171113ce31c
😎 Deploy Preview https://deploy-preview-2376--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.

@pkg-pr-new

pkg-pr-new Bot commented Nov 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: b96fccb

@lxsmnsyc
lxsmnsyc merged commit 460117b into solidjs:main Nov 4, 2026
13 checks passed
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?]: HEAD request returns 500 when a route's GET handler returns nothing

3 participants