question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Netflix Zuul query string encoding

See original GitHub issue

This is a copy of the stackoverflow issue: http://stackoverflow.com/questions/36475845/netflix-zuul-query-string-encoding

When sending a request via Zuul to a client, Zuul seems to change the query String. More specifically, if the client should receive an url-encoded query String, Zuul decodes the query String once. Here is a concrete example:

If “http://localhost:8080/demo/demo?a=http%3A%2F%2Fsomething/” is sent to the client, the client receives as a query String “a=http://something/”.

Looking into Zuul`s code, the function “buildZuulRequestQueryParams” uses “HTTPRequestUtils.getInstance().getQueryParams();” which decodes the query String.

Is this a desired feature or a bug?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
haagrawacommented, Apr 9, 2018

Just add following in application.yml file zuul : forceOriginalQueryStringEncoding: true

This will internally encode again your query param. You can also refer method buildHttpRequest() of class SimpleHostRoutingFilter

1reaction
hohwillecommented, Sep 12, 2017

Zuul simply does too much auto-magic here and therefore some apps stop working if they are operated behind zuul as reverse proxy. An example is e.g. foswiki that uses semicolon instead of ampersand as separator for query parameters. See also here for discussions on that but however, the w3c standard seems to allow this: https://stackoverflow.com/questions/3481664/semicolon-as-url-query-separator However, zuul does not allow this: https://github.com/Netflix/zuul/blob/c87e0c2a6b65a19ca8eb493d281ee812f7b60794/zuul-core/src/main/java/com/netflix/zuul/util/HTTPRequestUtils.java#L166

Ampersand as separator is considered as fixed separator char and semicolon is not honored. Hence everything behind the first equals sign is considered as value. Therefore subsequent equals signs are falsely escaped to %3D resulting in an invalid URL. An actual URL of a foswiki registration link send via Email looks as following: http://zuul.mydomain.org/foswiki/bin/register?action=approve;code=MyLogin.9285561;referee=AdminUser I can neither configure foswiki to use ampersand instead of semicolon nor I can make zuul pass these requests properly to the physical wiki server without breaking the request URL.

Conclusion: IMHO zuul is buggy here and needs to be fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netflix Zuul query string encoding - Stack Overflow
8.9 Query String Encoding When processing the incoming request, query params are decoded so that they can be available for possible ...
Read more >
8. Router and Filter: Zuul - Spring Cloud
Zuul is a JVM-based router and server-side load balancer from Netflix. ... To force the original encoding of the query string, it is...
Read more >
HTTPRequestUtils (Zuul Javadoc 0.5.2-SNAPSHOT)
Checks headers, query string, and form body for a given parameter. boolean, isGzipped(java.lang.String contentEncoding) return true if the client requested ...
Read more >
ProxyRequestHelper (Spring Cloud Netflix Zuul ... - javadoc.io
Get url encoded query string. Pay special attention to single parameters with no values and parameter names with colon (:) from use of...
Read more >
Netflix Zuul query string encoding - Bountysource
Netflix Zuul query string encoding ... When sending a request via Zuul to a client, Zuul seems to change the query String. More...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found