You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// this works with bug "socket hang up".
const Koa = require('koa');
const app = new Koa();
const proxy = require('koa-proxies')
const bodyParser = require('koa-bodyparser');
app.use(bodyParser())
app.use(proxy('/user', {
target: 'http://example.com',
changeOrigin: true,
rewrite: path => path
}))
app.listen(8080);
the only difference is the sequence of the bodyParser and proxy.
I guess the post data will be consumed by the bodyParser, that is not what we want and will not proxy to our target, so it should be placed behind the proxy.
It will save our time if document it. Thank you.
The text was updated successfully, but these errors were encountered:
I test koa proxies in my project, I find a weird bug when it works with
koa-bodyparser
.the only difference is the sequence of the bodyParser and proxy.
I guess the post data will be consumed by the bodyParser, that is not what we want and will not proxy to our target, so it should be placed behind the proxy.
It will save our time if document it. Thank you.
The text was updated successfully, but these errors were encountered: