I'm trying to use strip and redirect together and I'm not getting the behaviour I'd expect.
What I'm trying to do is:
urlprefix-<host>/news strip=/news redirect=301,https://<host>/bulletin/$path
However, the strip isn't working.
Looking at the code here:
|
if t.StripPath != "" && strings.HasPrefix(t.RedirectURL.Path, t.StripPath) { |
It looks like the redirect destination is assembled first, and then the strip prefix is checked. In my case this would first convert /new/foo into /bulletin/news/foo, then attempt to apply the strip - which will fail.
I suspect the code should actually be applying the prefix check and strip to the replaceRawPath var rather than the t.RedirectURL.Path var.
I'm trying to use strip and redirect together and I'm not getting the behaviour I'd expect.
What I'm trying to do is:
urlprefix-<host>/news strip=/news redirect=301,https://<host>/bulletin/$pathHowever, the strip isn't working.
Looking at the code here:
fabio/route/target.go
Line 99 in 231e7f2
It looks like the redirect destination is assembled first, and then the strip prefix is checked. In my case this would first convert
/new/foointo/bulletin/news/foo, then attempt to apply the strip - which will fail.I suspect the code should actually be applying the prefix check and strip to the
replaceRawPathvar rather than thet.RedirectURL.Pathvar.