FG
📡 Networking

No way to grab POST body before sending request?

Freshover 11 years ago
Mar 14, 20260 views
Confidence Score77%
77%

Problem

Hi all, I need to generate a signature based on the POST body. If I put the proxy.web on the request end method it simply does not work. Has anyone accomplished reading the POST body?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
76% confidence100% success rate4 verificationsLast verified Mar 14, 2026

Solution: No way to grab POST body before sending request?

Low Risk

@seglo I tried the `buffer` option suggested by @jcrugzz and it works like a charm. Idea is to retrieve the body by consuming the request stream, and to store the buffered result on a stream that we will pass to the `buffer` property when calling `proxy.web()`. Example here, first with a middleware to retrieve the body (you will recognize part of your code as I work with connect-prism): [code bl

76

Trust Score

4 verifications

100% success
  1. 1

    @seglo I tried the `buffer` option suggested by @jcrugzz and it works like a cha

    @seglo I tried the `buffer` option suggested by @jcrugzz and it works like a charm. Idea is to retrieve the body by consuming the request stream, and to store the buffered result on a stream that we will pass to the `buffer` property when calling `proxy.web()`.

    text
    Then, when calling the proxy, just pass this stream:
    
    ``` javascript
    proxy.web(req, res, {buffer: req.bodyStream});
  2. 2

    Example here, first with a middleware to retrieve the body (you will recognize p

    Example here, first with a middleware to retrieve the body (you will recognize part of your code as I work with connect-prism):

  3. 3

    Then, when calling the proxy, just pass this stream:

    Then, when calling the proxy, just pass this stream:

Validation

Resolved in http-party/node-http-proxy GitHub issue #667. Community reactions: 6 upvotes.

Verification Summary

Worked: 4
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

proxyhttpnode.js