Description
Vue-cli used http-proxy-middleware and had router option which let change actual url for specific requests.
It is very useful when you have multiple backends (mockserver, other department' server) or want to set backend dynamically at a runtime (different versions, API change, change backend server without locally starting frontend server, etc.).
It is a niche feature, but very useful when actually needed. There's also seems to be considerable amount of people interested based on #13968, #13932, #2808. I personally had a case where we needed to monkey-patch vite to add this feature in one big company and interested on contributing it.
Thank you for consideration!
Suggested solution
Following previous PRs and comments:
- Modify
target to be either a normal proxy target or (req) => target
- Modify the code to call this resolve function and resolve to the target url
- Add tests
Alternative
Currently there's no alternative solutions for such cases except monkey patching or following alternative deployment or development processes (Docker, move proxy to backend, etc.)
Additional context
There were already open PR exist, but it seems to be stale and maintiner gave a pass to reopen it.
Validations
Description
Vue-cliusedhttp-proxy-middlewareand hadrouteroption which let change actual url for specific requests.It is very useful when you have multiple backends (mockserver, other department' server) or want to set backend dynamically at a runtime (different versions, API change, change backend server without locally starting frontend server, etc.).
It is a niche feature, but very useful when actually needed. There's also seems to be considerable amount of people interested based on #13968, #13932, #2808. I personally had a case where we needed to monkey-patch vite to add this feature in one big company and interested on contributing it.
Thank you for consideration!
Suggested solution
Following previous PRs and comments:
targetto be either a normal proxytargetor(req) => targetAlternative
Currently there's no alternative solutions for such cases except monkey patching or following alternative deployment or development processes (Docker, move proxy to backend, etc.)
Additional context
There were already open PR exist, but it seems to be stale and maintiner gave a pass to reopen it.
Validations