serve
serve copied to clipboard
Can we have option to proxy similar to nginx
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.
yeah, I just like to test builds on my laptop and need to proxypass to an api....very valid use case
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)
shameless self-promotion alert:
this feature is available in my @warren-bank/serve fork of serve
notes about using redirect rules:
- require an
engineattribute..
which permits you to choose which methodology/library is used to:- match the url pathname against a pattern
- replace capture groups
- an optional boolean
proxyattribute can be used to:- download from an external url
- pipe the response back to the client