Special character in the URL getting encoded.How to replace that with the actual characters?

Not applicable

Getting :: as query-param part of Request URL. Apigee converts :: to %3A%3A and the target URL going out of Apigee contains this(%3A%3A).

eg. https://hostname:port/basepath?q=q1&filter=name::john

getting converted to

https://hostname:port/basepath?q=q1&filter=name%3A%3Ajohn

Because of the above change not getting the desired response as backend is not able to resolve %3A%3A.

I am using below javaScript to convert this but ending up with the same outgoing URL.

var qstring = context.getVariable("message.querystring");

var qstringUpd = qstring.replace("%3A%3A","::");

context.setVariable("target.url","https://hostname:port/basepath?"+qstringUpd);

It will be great help if someone can provide solution or suggest.

7 12 10.3K
12 REPLIES 12

well, its the spec - query params needs to be URL encoded,

the http clients and http servers should be able to URL encode/decode as needed, what is your backend? and why do you think encoding is the issue?

Have you tested by directly going to your backend?, http clients would anyway encode the URL params, so how are you testing it?

and, to answer your question - you cannot replace it with actual characters

While testing directly through Postman it is working fine and giving desired response. But when it goes via Apigee it is creating issue. Somehow backend is not able to encode the http url. Is there any way at apigee layer we can deal with it OR this is how Apigee works?

thats odd, i am sure postman encodes the params [even if you do not see it in the client's text box]. can you look into the JS console and see the actual request being sent? and compare it with the trace on what Apigee is sending? maybe we are missing some other params.

is it just a pass thro proxy? is your target url accessible in the internet, if so, can you give a sample URL?

Yes it is a pass through. But not accessible over internet.And even when i hit the backend URL directly from browser I can clearly see the difference. Means from browser when i pass :: i am getting the desired filtered response But when i manually change it to %3A%3A and hit it,not getting the desired response.

hmm, i did a quick check - apigee always receives

"/?filter=name%3A%3AJohn"

irrespective of my client [chrome, curl, postman] sending filter=name::John and name%3A%3AJohn,

Can you log these at your server and see if there is any difference?

Changing the URL to include %3A in the request at the browser would lead to a double encoding situation, as the browser will encode the leading percent signs. It is not a valid test of this situation.

@SoneshSharma

Have you found out any workaround to this situation? as i have also been facing this issue since long.

No such Workaround.

As per my knowledge this is how Apigee works.

Ideally your back end should be able to read/resolve this.

That's a bummer, I came all the way down here hoping to find a solution

Hi! What seems to be the issue for you?

If you want help, maybe post a new question here (click the button labeled "Ask a Question" in the upper right) with your specific details.  It will get better response than posting a brief comment buried in a 7-year old thread.