Skip to content

missing accept head return 404 error #277

Description

@aheissenberger

Describe the bug

When a client issues a request without accept header, the react server will return a 404 error.

Based on HTTP specification RFC 9110 §12.5.1:
If no Accept header is present:
The server may assume that the client accepts any media type (/).

So, the effective behavior is as if the client sent:
Accept: */*

That means:
• The server can return its default representation (often text/html, application/json, or whatever makes sense for the endpoint).
• It should not return 406 Not Acceptable unless it truly has no representation to serve.

Reproduction

No response

Steps to reproduce

  1. cd examples/hello-world
  2. pnpm build && pnpm start

broken return:

curl -v -H "User-Agent:" -H "Accept:" http://localhost:3000
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:3000...
* Connected to localhost (::1) port 3000
> GET / HTTP/1.1
> Host: localhost:3000
> 
* Request completely sent off
< HTTP/1.1 404 Not Found
< Date: Sun, 02 Nov 2025 21:15:35 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

Note: problem exists for Accept: */* too

expected output:

curl -v -H "User-Agent:" -H "Accept: text/html" http://localhost:3000
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:3000...
* Connected to localhost (::1) port 3000
> GET / HTTP/1.1
> Host: localhost:3000
> Accept: text/html
> 
* Request completely sent off
< HTTP/1.1 200 OK
< cache-control: must-revalidate
< content-type: text/html; charset=utf-8
< last-modified: Sun, 02 Nov 2025 21:19:31 GMT
< Date: Sun, 02 Nov 2025 21:19:51 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
<link rel="preconnect" href="/" id="live-io"/><h1>Hello World</h1

System Info

System:
    OS: macOS 15.7.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 258.80 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.1.0 - /opt/homebrew/bin/node
    npm: 11.6.2 - /opt/homebrew/bin/npm
    pnpm: 9.15.5 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 141.0.7390.123
  npmPackages:
    @lazarv/react-server: workspace:^ => 0.0.0

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions