Closed paul-pro closed 3 years ago
Hi, could you give me an example of a URL which does not redirect correctly? I did a quick check using the redirect debugging tool, the output looks ok:
$ npx lws-rewrite '/app-name/(.*)-service/(.*)/' 'https://domain.com/app-name/$1-service/$2' /app-name/test-service/test/
https://domain.com/app-name/test-service/test
Thank you for the quick answer! When I am modifying lib sources like
I am seeing
remoteUrl is /app-name/test-service/test
(instead of expected https://domain.com/app-name/test-service/test
)
what is the ctx.url
value passed to that util.getTargetUrl
invocation? (the third arg)
Thanks, I was able to track down that the actual request URL has no slash /
at the end and the rewrite rule has one, so my regExp was returning empty fromMatches
-> returning initial URL itself, instead of replaced remote URL.
I was confused with this rule triggering at all (and then failing to create regExp), but still thanks a lot for you help
ok, no worries.. hopefully the debugging tool can help you develop and test your rewrite expressions in future 👍
Hi! I was trying to establish a local server for a built version of my application with a lot of api requests (so a lot of redirects). Most of the requests use relative URL and when I try to redirect them with
--rewrite '/app-name/(.*)-service/(.*)/ -> https://domain.com/app-name/$1-service/$2'
config I get the following error:Error: Protocol missing from request
seems like utils.getTargetUrl called with this relative URL and rewrite.to ends up being relative as well (despite provided full remote URL). Do I miss something in my config or local-web-server should append base to the relative URLs?Thanks!