serve icon indicating copy to clipboard operation
serve copied to clipboard

Can we have option to proxy similar to nginx

Open iknityanand opened this issue 5 years ago • 4 comments

Hi team,

Is there an option or documentation on how to proxy request using serve. I am looking for reverse proxy and load balancing options here.

iknityanand avatar May 28 '20 05:05 iknityanand

yeah, I just like to test builds on my laptop and need to proxypass to an api....very valid use case

Morriz avatar Jul 28 '20 22:07 Morriz

You could consider as a temp solution to use e.g. Caddy as entry point / reverse proxy: https://caddyserver.com/docs/caddyfile/patterns#reverse-proxy

                      /--> /app/... (npx serve)
request -> Caddy proxy
                      \--> /api1/... (e.g. Nginx)
                      \--> /api2/... (e.g. Apache)

heidemn avatar Jun 03 '21 00:06 heidemn

shameless self-promotion alert:
this feature is available in my @warren-bank/serve fork of serve

notes about using redirect rules:

  • require an engine attribute..
    which permits you to choose which methodology/library is used to:
    • match the url pathname against a pattern
    • replace capture groups
  • an optional boolean proxy attribute can be used to:
    • download from an external url
    • pipe the response back to the client

warren-bank avatar Feb 16 '22 07:02 warren-bank