Add prefix to target end point | APIGEE Edge | Trim the info

sjacob-1
Participant I

Hi All,

Below are my APIGEE settings:

basePath: /draw

proxyEndpoint: https://api.gaming.com/draw

targetServers (prod): lucky.win.services

As a matter of fact below is the url that has to be used to hit my backend services.

https://api.gaming.com/draw/draw/v1/lists

You can notice the `/draw` coming 2 times :

1. first one is my base path

2. second comes with my path suffix.

My requirement is to trim proxyEndpoint to have only one `/draw` and in the proxy flow to add the second `/draw`

https://api.gaming.com/draw/v1/lists ---> Proxy Pre-Flow --> https://api.gaming.com/draw/draw/v1/lists

before hitting the backend services

It would be of great help if i get some advise on the same, being a novice into APIGEE

0 8 484
8 REPLIES 8

Not applicable

it's very confusing me. Can you just specify what should be the api request url and what should be the request url to the backend?

sjacob-1
Participant I

@priyadarshi The request url would be https://api.gaming.com/draw/v1/lists and i have to where `/draw` is the base path and `/v1/lists` is the path suffix.

I want to prefix one more `/draw` to the path suffix. It should look like

`https://api.gaming.com/draw/draw/v1/lists` before hitting the target url

Not applicable

ok, I got the question.

<HTTPTargetConnection>    <SSLInfo>      <Enabled>true</Enabled>    </SSLInfo>    <LoadBalancer>      <Server name="testserver"/>    </LoadBalancer>    <Path>/draw/draw</Path></HTTPTargetConnection>

configure testserver to the backend url.

Thanks for the reply @Priyadarshi . But i would want to make it dynamic, not hard coded in the Path tag.


Would that be possible?

yes, then you can set target.url to "https://api.gaming.com"+"/draw/draw"+proxy.pathsuffix

using javascript or assign message in the target endpoint preflow.

you need to use context.setVariable and context.getVaribale when using javascript.

sjacob-1
Participant I

Great thanks a lot. I shall try the same

sjacob-1
Participant I

Sure. I have used it