Thanks for the great work on the 11ty ecosystem! I would like to incorporate this plugin and remove @11ty/eleventy-server-browsersync, but I have a use case similar to #9. Below I show my use case with the browsersync plugin and http-proxy-middleware to proxy the entire request to a development backend. I believe this library could replicate the behavior below if onRequest passed the request or request body so that I could forward the request with the form data for methods such as POST (11ty creates HTML forms that post data)
What are your thoughts on this for your library?
const apiProxy = createProxyMiddleware({
pathFilter: opts.intercept,
target: opts.backend,
changeOrigin: true,
logger: console,
on: {
proxyReq: function (proxyReq, req) {
proxyReq.setHeader("Authorization", opts.authorization || "");
proxyReq.setHeader(
"Referer",
req.headers.referer?.replace(
"http://localhost:8080",
`http://${process.env.HOSTNAME}:8080`,
) || "",
);
},
},
});
config.setServerOptions({
module: "@11ty/eleventy-server-browsersync",
port: 8080,
open: false,
notify: false,
ui: false,
ghostMode: false,
snippet: true,
middleware: [apiProxy],
});
Thanks for the great work on the 11ty ecosystem! I would like to incorporate this plugin and remove @11ty/eleventy-server-browsersync, but I have a use case similar to #9. Below I show my use case with the browsersync plugin and http-proxy-middleware to proxy the entire request to a development backend. I believe this library could replicate the behavior below if
onRequestpassed the request or request body so that I could forward the request with the form data for methods such as POST (11ty creates HTML forms that post data)What are your thoughts on this for your library?