Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Correct docs for proxyReqOptDecorator - cannot modify request path #33

Merged
merged 1 commit into from
Jan 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ You can mutate the request options before sending the proxyRequest.
proxyReqOpt represents the options argument passed to the (http|https).request
module.

NOTE: req.path cannot be changed via this method; use ```proxyReqPathResolver``` instead.

```js
app.use(proxy('www.google.com', {
proxyReqOptDecorator: function(proxyReqOpts, ctx) {
// you can update headers
proxyReqOpts.headers['content-type'] = 'text/html';
// you can change the method
proxyReqOpts.method = 'GET';
// you could change the path
proxyReqOpts.path = 'http://dev/null'
return proxyReqOpts;
}
}));
Expand Down