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

Janus is encoding already encoded URL in reverse-proxy.go #499

Open
namitaofficial22 opened this issue May 27, 2024 · 0 comments
Open

Janus is encoding already encoded URL in reverse-proxy.go #499

namitaofficial22 opened this issue May 27, 2024 · 0 comments

Comments

@namitaofficial22
Copy link

[Short description of problem here]
If curl is done with http://example.com/a%2Fv (to imitate request from a web UI), Janus is sending a%%252Fv to the upstream server.

Reproduction Steps:

  1. Set httpd configuration to allowedEncodedSlash as true and rewriterule with [P, NE]
  2. Bring up apigateway
  3. Send curl command like http://example.com/a%2Fv
  4. Upstream is getting path as a%252Fv and rejecting the request.

Expected behavior:
URL should not be encoded with rewriterule as [P, NE] and Proxypass as nocanon.

[Describe expected behavior here]
In reverse_proxy.go, found some strange code which might be causing this issue. I could reproduce the issue in a simple golang code.

            log.WithField("path", path).Debug("Upstream Path")
            req.URL.Path = path

When we set path(a%2Fv) in the above line, and then call req.URL.RequestURI() it is giving escaped path(a%252Fv)
.

Observed behavior:

Sample output with the golang program:

Program Snippet:
func main() {
// Get the full request URI
req, _ := http.NewRequest("GET", "http://example.com/a%2Fv", nil)
requestURI := req.URL.RequestURI()

// Print the request URI
fmt.Println("Request URI: \n", requestURI)
req.URL.Path = "a%2Fv"
fmt.Println("After URI: \n", req.URL.RequestURI())

}

O/p:
Request URI:
/a%2Fv
After URI:
a%252Fv

Janus version: [Enter Atom version here]
OS and version: [Enter OS name and version here]

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

No branches or pull requests

1 participant