chimurai / http-proxy-middleware

:zap: The one-liner node.js http-proxy middleware for connect, express, next.js and more
MIT License
10.68k stars 826 forks source link

Support edge #846

Closed pszer666 closed 1 year ago

pszer666 commented 1 year ago

Describe the feature you'd love to see

Hi there, thanks for your hard work and this great library! it's awesome...

We are using next js on AWS but recently we notified that Cloudflare is available to support SSR using experimental edge feature, but when we tried to migrate to cloudflare edge we notified that there some limitations like size of each edge function. We failed at this step and we even don't know if this library supports edge or not. So I have two points here to mentioned.

  1. Does this library support edge?
  2. Is there anyway to use lightweight version to reduce bundle size?

more context: https://vercel.com/docs/concepts/functions/edge-functions/limitations#code-size-limit

Thanks in advance

Additional context (optional)

No response

chimurai commented 1 year ago

Hi. You're the first one to ask this question.

Personally I haven't worked with edge yet.

The maximum size for an Edge Function is 1 MiB after compression, including your JavaScript code, imported libraries, and all files bundled in the function.

Did a measurement of http-proxy-middleware bundle size on budlejs.com: https://bundlejs.com/?q=http-proxy-middleware&config=%7B%22esbuild%22%3A%7B%22format%22%3A%22cjs%22%2C%22platform%22%3A%22node%22%7D%7D

http-proxy-middleware seems to be only 28.63KB compressed (gzip).

Do you have a size breakdown of your project?

pszer666 commented 1 year ago

I also don't have any experience with it, we just wanted to migrate from AWS serverless to new supported cloudflare and we saw this issue about the bundle size in our edge functions for example in one functions we only use http-proxy-middleware so we thought it might the reason that it failed while building.

chimurai commented 1 year ago

Bundled http-proxy-middleware is 28.63KB, which is well in within the limits of the 1MB.

Without concrete analysis there is little I can do.

Feel free to re-open when you can provide more information.