Skip to content

Running 'setHeader' during 'proxyReq' event fails for POST requests #1168

Open
@lrettig

Description

@lrettig

Hello,

I'm running into the same issue that happened in #908 which was supposed to have been solved already, but it's occurring for me now on the latest v1.16.2. Trying to do a setHeader on the passed in proxyReq for a POST requests fails with:

Error: Can't set headers after they are sent.

It's happening for both node 4.3.2 and 6.1.0.

To reproduce:

proxy.on('proxyReq', function(proxyReq, req, res, options) {
  proxyReq.setHeader('origin', 'https://example.com');
});

Thank you.

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