New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow removing proxy
prefix
#176
Comments
There are a few possible solutions I can think of:
|
Fixes elm-land#176 The behavior is based on the `pathRewrite` in `http-proxy-middleware` where the first matching pattern determines the rewrite: https://github.com/chimurai/http-proxy-middleware/blob/f2a0af329969f8a70b3967a969146758a73d8b0e/src/path-rewriter.ts#L33-L39
As of #160, we can proxy requests from
"/api"
to"http://localhost:5000/api"
, by specifyingbut we're not able to proxy requests from
"/api"
to"http://localhost:5000"
using this setting; we can't remove the"/api"
prefix.Stripping the prefix seems like a common use case when proxying requests.
elm-live
's--proxy-prefix
is removed by default:This is also how proxying requests works in NGINX config
Vite's config exposes a
rewrite
function that is often used for this purpose, but we can't do this withelm-land
's config because we're limited to JSON. There may also be a desire not to expose Vite server options directly.This has been the only notable painpoint so far when migrating an Elm app—that currently uses these
elm-live
and NGINX proxy settings to proxy requests to a handful of services that have a shared base URL but no common route prefix—toelm-land
. I haven't found a satisfactory solution. Inelm-land.json
we can specify that each service gets proxied:which works, but we also need to maintain an identical mapping in our
nginx.conf
.The text was updated successfully, but these errors were encountered: