Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-leapyear authored and monkpow committed Sep 11, 2023
1 parent 0d5bf43 commit a530d14
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,27 @@ app.use('/', proxy(selectProxyHost));

If you use 'https://www.npmjs.com/package/body-parser' you should declare it AFTER the proxy configuration, otherwise original 'POST' body could be modified and not proxied correctly.

```
app.use('/proxy', 'http://foo.bar.com')
```js
app.use('/proxy', proxy('http://foo.bar.com'))

// Declare use of body-parser AFTER the use of proxy
app.use(bodyParser.foo(bar))
app.use('/api', ...)
```

If this cannot be avoided and you MUST proxy after `body-parser` has been registered, set `parseReqBody` to `false` and explicitly specify the body you wish to send in `proxyReqBodyDecorator`.

```js
app.use(bodyParser.foo(bar))

app.use('/proxy', proxy('http://foo.bar.com', {
parseReqBody: false,
proxyReqBodyDecorator: function () {

},
}))
```

### Options

#### proxyReqPathResolver (supports Promises)
Expand Down

0 comments on commit a530d14

Please sign in to comment.