Skip to content

Request failing to receive response. #196

Description

@eldhosejoys

My proxy has the following setting:

  proxy = mockttp.getLocal({
    https: ca,
    http2: true,
    socks: false,
    recordTraffic: false,
    debug: false,
    passthrough: ['unknown-protocol'], 
  });

  proxy.forAnyRequest().thenPassThrough({
    simulateConnectionErrors: true,
    async beforeRequest(request: CompletedRequest) { },
    async beforeResponse(
      response: PassThroughResponse,
      request: CompletedRequest
    ) { },
  });

But if my response contain duplicate header for

x-content-type-options: nosniff
x-content-type-options: nosniff

this is throwing error as :

Failed to handle request: Header field "x-content-type-options" must only have a single value

Can't we just simply skip that throw? I use mockttp version 4.1.0

Activity

  1. pimterry commented on Oct 31, 2025

    @pimterry
    Member

    Unfortunately this is a constraint in Node.js itself, not in Mockttp. I've opened an issue (nodejs/node#59651) and a PR there (nodejs/node#59917) but not much movement yet, and it'll need to be merged & released and then you'll need to update Node.js before this can start working.

    Concrete real-world examples are helpful to make this happen though. Do you know the specific URL that's sending this response and triggering this error? Being able to reproduce that would be very useful.

  2. eldhosejoys commented on Oct 31, 2025

    @eldhosejoys
    Author

    Do you know the specific URL that's sending this response and triggering this error? Being able to reproduce that would be very useful.

    just use this URL i found:

    https://tech.unblockedgames.world/

    They send headers multiple times.

  3. eldhosejoys commented on Oct 31, 2025

    @eldhosejoys
    Author

    Also how do you manage this in httptoolkit. I don't see a problem in getting this in httptoolkit app.

  4. pimterry commented on Oct 31, 2025

    @pimterry
    Member

    The specific issue here is because you're using HTTP/2 - this constraint only applies to HTTP/2 traffic. HTTP Toolkit defaults to HTTP/1 for most clients (except clients that must use HTTP/2) because it's simpler to understand for most users, and more mature internallyt (i.e. it doesn't have rough edges like this). You can change that behaviour in the Pro settings if you're interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions