We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const Koa = require("koa"); const http = require("http"); const proxy = require("koa-proxies"); const router = require("koa-router")(); const app = new Koa(); app.use(async (ctx, next) => { console.log("start"); await next(); console.log("end", ctx.body); }); app.use( proxy("/proxy", (params, ctx) => { ctx.respond = false; return { target: "http://127.0.0.1:22311", changeOrigin: true, }; }) ); router.get("/test", async function (ctx, next) { ctx.body = "test"; next(); }); app.use(router.routes(), router.allowedMethods()); var server = http.createServer(app.callback()); const hostname = "0.0.0.0"; const port = 8081; server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });
When I access /test, I can get the following results:
/test
However, when I access /proxy, I cannot get the proxy results from end.
/proxy
I know that the return result is handled throughproxyRes, but what causes this difference?
proxyRes
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I access
/test
, I can get the following results:However, when I access
/proxy
, I cannot get the proxy results from end.The text was updated successfully, but these errors were encountered: