Using http-proxy-middleware agent in koa2 didn't work.

Koa2 and http-proxy-middleware are used as proxies when server rendering is set in

react, and no proxies are found to be successful

Mapping local port 3333 to 8889, not found.

router.get("/", async function(ctx, next) {
    var template = await getTemplate()
    const content = ReactDomServer.renderToString(serverBundle)
    ctx.body = template.replace("<!-- app -->", content)
    next()
})
router.get("/public",
    c2k(
        proxy({
            target: "http://localhost:8889/",
            changeOrigin: true,
            
        })
    )
)

Mar.20,2021
Menu