Closed supasympa closed 7 years ago
What about calling http://localhost:3000/reply ? http://localhost:3000 (ie the root) is itself not proxied, only /reply
I've just created a new project, and ran yarn add koa@2 koa-router@next koa-body@next koa2-pixie-proxy
. Then I pasted the content of your code above into an index.js file, and added the following at the bottom, in order to simulate your proxied server on port 2001:
const otherApp = new Koa();
otherApp.use(ctx => ctx.body = 'OK!');
otherApp.listen(2001);
If I execute the file and browse to http://localhost:2001 i see 'OK!'. I get the same if I browse to http://localhost:3000/reply.
If you want the http://localhost:3000 url to return something other than a 404, you need to either add some middleware to the Koa instance on port 3000 that will serve content, or proxy the root route as well as /reply.
Thanks @sc0ttyd. Sorry if I wasted any of your time I must have messed up.
Hey, no problem, glad I could help!
On 27 Feb 2017 20:56, "Lewis Barclay" notifications@github.com wrote:
Thanks @sc0ttyd https://github.com/sc0ttyd. Sorry if I wasted any of your time I must have messed up.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sc0ttyd/koa2-pixie-proxy/issues/5#issuecomment-282850717, or mute the thread https://github.com/notifications/unsubscribe-auth/AATvb2FEJwnzB8XvRCUZ5Yv2THOEmoVJks5rgziYgaJpZM4MGGaR .
It doesn't seem to work with my installation of Koa2
Calling http://localhost:3000 returns NOT FOUND I can open http://localhost:2001 directly and it works as expected.