How to change proxy pathsuffix before send it to target backend

Hi ,,

How do I change proxy.pathsuffix before send it to target url 

For example 

The request is:

 https://xxx.xxx.xx/v1/api/flight-reservations/123e4567

I want to send it to backend as:

 https://xxx.xxx.xx/v1/api/flight-reservations/1

I tried to to do this by 

context.setVariable(proxy.pathsuffix, xxxx);

but it didn't work cause proxy path suffix is a read only variable 

Any Idea ?

Thanks

Solved Solved
1 1 1,461
1 ACCEPTED SOLUTION

I found the solution by using  AssignMessage policy:

 

<AssignMessage name="Assign-Message-1">
    <AssignVariable>
        <Name>target.url</Name>
        <Value>https://xxx.xxx.xx/v1/api/flight-reservations/{id}</Value> 
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

to works fine you must put this policy in the TargetEndpoint 

 

override the target.url variable in the TargetEndpoint using the <AssignVariable> element. (You can't override target.url in the ProxyEndpoint, because Edge sets the variable in the TargetEndpoint).

 

View solution in original post

1 REPLY 1

I found the solution by using  AssignMessage policy:

 

<AssignMessage name="Assign-Message-1">
    <AssignVariable>
        <Name>target.url</Name>
        <Value>https://xxx.xxx.xx/v1/api/flight-reservations/{id}</Value> 
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

to works fine you must put this policy in the TargetEndpoint 

 

override the target.url variable in the TargetEndpoint using the <AssignVariable> element. (You can't override target.url in the ProxyEndpoint, because Edge sets the variable in the TargetEndpoint).