Skip to content
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

Response header mapping replaces every occurrence of TargetPath with ListenPath #5548

Open
jyrimatti opened this issue Sep 11, 2023 · 0 comments

Comments

@jyrimatti
Copy link

Branch/Environment/Version

  • Branch/Version: Master
  • Environment: Any

Describe the bug
Trying to map response headers while reverse proxying replaces every occurrence of TargetPath with ListenPath instead of just first one. We need redirects (Location response header) to map correctly from "/some/path" to "/foo/bar/some/path".

Reproduction steps
Steps to reproduce the behavior:

  1. Set up reverse proxy for some content using redirects
  2. Set TargetPath to "/"
  3. Set ListenPath to "/foo/bar/"
  4. Check "Strip the listen path"

Actual behavior
For example in our case TargetPath is "/" and ListenPath is "/foo/bar/" and the Location header gets mapped from "/some/path" to "/foo/bar/some/foo/bar/path".

Expected behavior
We'd expect the Location header be mapped from "/some/path" to "/foo/bar/some/path". I'd guess that the last "-1" argument in these lines (probably also other near-by similar lines) should be "1" instead, unless of course this is for some reason intentional?

val = strings.Replace(val, h.Spec.target.Path,
h.Spec.Proxy.ListenPath, -1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants