Apigee adding a backslash at the last of URL

Not applicable

I'm accessing below apigee configured URL

https://xyzabc.com:9111/oauth2?client_id=zrgst&scope=xyz

when I'm tracing this url at Apigee i'm getting following URL

https://xyzabc.com:9111/oauth2?client_id=zrgst&scope=xyz/

I'm facing this issue of adding a backslash while I'm accessing URL from iOS phone and my desktop chrome browser.

Due to this extra slash I'm facing a lots of issues, It will be great help if someone can provide solution.

2 13 792
13 REPLIES 13

Hi Chetan. It's not clear what you mean by "when I'm tracing this url at Apigee I'm getting...."

Are you saying that the inbound request includes a trailing slash?

Are you saying that the Apigee Edge logic is appending a trailing slash?

Can you elaborate on what you're seeing please?

Not applicable

Hi Dino, Yes I'm getting a trailling slash which seems to be be added by Apigee. I can see in my browser there is no white space or trailing slash in the end.

hi Chetan, it's hard to know what's really happening, without being able to see the flows you've configured. As you may know, depending on how you configure it, Apigee Edge can do "anything" with the inbound request, including something as simple as appending a slash to the path.

Can you elaborate on your configuration please? Please be very very specific. You told me "Apigee is appending a slash" - I've got that. What I need now is more detail. Remember I cannot see anything you can see. I know nothing about the configuration you're working with. So the more you can tell me, the more likely it is I'll be able to suggest something that might help.

What flows have you got configured? How did you configure the OAuth proxy? What is the backend target? Where do you see the slash appended - exactly how are you becoming aware that there is an extra slash? Which screen are you looking at that indicates there is an extra slash? Can you include a screenshot? etc etc etc

You said "Due to this extra slash I'm facing a lots of issues,".... What problems are you facing due to the slash? Can you elaborate please?

Not applicable

apigeeexceptionbackslash.png Please check image for more details, I'm getting trailing slash only in this API proxy.

Not applicable

Hi Dino,

I hope you have seen the above screenshot, I'm getting this errors in only oAuth urls i.e. while asking for accesstoken or generating the oAuthcode.

Please help me out in this, if you have seen such error before.

I've just now seen the screenshot. You've obscured much of the URL. It appears to me that the slash is uri-encoded, and is part of the scope query parameter. This also appears to be arriving from the client caller. I cannot tell for sure though.

Also, you haven't answered any of my other questions; see my prior requests - there are numerous questions there. I'm going to have a hard time helping if you can't provide any further information. Sorry!

Hi Chetan,

Do you get this error if you use curl or another client? Does it always happen, or is it just from specific clients?

Hi Carlos,

I tried with different clients, and every time I'm facing this issue.

Not applicable

Hi Dino, After Drilling down more, I found following scenario when the problem occurs:

  • If the URL atclient side is not encoded(consist '://' in the queryparms) e.g.

http://enterprise.apigee.com/test?callbackurl=http://example.com&Scope=read

  • Then URL I'llreceive at Apigee will be with a trailing slash e.g.

http://enterprise.apigee.com/test?callbackurl=http%3F%2F%2Fexample.com&Scope=read%2F

  • If the URL at client side is allready encode(consist '%3F%2F%2F' in place of '://') e.g.

http://enterprise.apigee.com/test?callbackurl=http%3F%2F%2Fexample.com&Scope=read

  • Then the URL received at Apigee will be with no trailing slash

http://enterprise.apigee.com/test?callbackurl=http%3F%2F%2Fexample.com&Scope=read

In My ExistingApigee setup everything was working fine the first URL, but now we are moving to new setup where this problem occurs at Apigee version 4.14.70.

I cann't encode the URL at client side because it requires changes in all our mobile applications.

Not applicable

Hi Dino,

Due to this problem,at the time of checking SCOPE, CallBackURL or ClientID, I got an exception because either one of them(last paramter) will consist a trailingslash.

Hi @chetan chouhan,

It's possible this is will require a code change, but before we discuss that, would you mind downloading your "bundle" (the API Proxy itself will download as a .zip file), and then uploading and testing your bundle on a Developer Edition org in Apigee Cloud? You can create one for free.

The reason I mention this is because you are running 4.14.70, and there are newer versions than that, the latest of which is already deployed to our Cloud. If this has been rectified since, then the solution would be to upgrade. If not, any Apigeek here in the Community would be happy to submit a defect case.

But what would this Community be without a helpful workaround?

I'd suggest some custom Javascript or Python that simply grabs the URL sent by the Client and manipulates it how you want it. For example, you could force the query-string parameters of all URLs coming into your Apigee policies to be URL-encoded (as in the third URL you posted in your last comment). This would be an easy way to control what is seen by the Apigee policies without having to make any code changes on the Client.

I hope this helps. Thanks.

Hi Alex,

Thanks for help.

I imported the same proxy at cloud version, and that is working fine. So can I conclude this is the version specific issue of Apigee Edge? Is there any other work around through some policy to remove this trailing slash except upgrading the edge version.