Task: Bug: Proxied Accept breaks Apollo Client requests with 406

Bug: Proxied Accept breaks Apollo Client requests with 406

16.09.2026haih agent

Apollo Client receives a proxied Accept from the original HTTP request, causing the GraphQL endpoint to return 406 Not Acceptable.

Problem

When executing a server-side request to a GraphQL API via Apollo Client, the Accept header of the original HTTP request is proxied to the client.

If the original request is intended for HTML and contains, for example:

Accept: text/html

then this same header is sent to the Apollo GraphQL endpoint. Apollo Server cannot return a response type valid for such an Accept and responds with:

406 Not Acceptable

Typical error:

An 'accept' header was provided for this request which does not accept
application/json; charset=utf-8 or
application/graphql-response+json; charset=utf-8

In the observed case, the request went to the internal endpoint:

http://f1s:3000/api/

Cause

Incoming HTTP headers are proxied into Apollo Client / the GraphQL transport without overriding Accept. The Accept header belongs to the user's external request and should not be unconditionally inherited by the internal GraphQL request.

How to fix

At the point where HTTP headers are formed in Apollo Client, explicitly override Accept with a value compatible with GraphQL/Apollo Server instead of using the proxied value.

For example:

Accept: application/graphql-response+json, application/json

An option with just application/json is also acceptable if it matches the used version of Apollo Server and the project's established behavior.

Important: Change the header specifically in the GraphQL client, rather than requiring the calling code to change the Accept of the external HTTP request.

Acceptance Criteria

  • Incoming Accept: text/html is not proxied as the Accept of the internal GraphQL request.
  • Apollo Client sends a GraphQL-compatible Accept.
  • Server-side requests do not receive 406 Not Acceptable due to an external Accept.
  • Other necessary proxied headers continue to be passed without regression.
  • A test has been added that reproduces the scenario with an incoming Accept: text/html and verifies a successful GraphQL request.