Hi,
I have a requirement where i have to remove the /employer/{employer-id} from the below url. How can this be achieved ?
/register/employer/{employer-id}/documents/{id}
Expected output after modified url.
/register/documents/{id}
@AbdulH - can you confirm what your proxy base path?
Also - if your URL is https://$HOST/register/employer/{employer-id}/documents/{id} and your backend is https://$TARGET_HOST/register/documents/{id}, then you can use an Extract Variable policy and extract the employerId and documentId using URIPath
<ExtractVariables async="false" continueOnError="false" enabled="true" name="EV-Extract-IDs">
<DisplayName>EV-Extract-IDs</DisplayName>
<Source>request</Source>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<URIPath>
<Pattern ignoreCase="false">/register/employer/{employerId}/documents/{docId}</Pattern>
</URIPath>
</ExtractVariables>
NOTE: The URIPath Pattern does not include the basepath of the proxy so please update your policy code accordingly.
And then in your Target URL configuration in the TargetEndpoint you can use.
<TargetEndpoint name="default">
<HTTPTargetConnection>
<LoadBalancer>
<Server name="targetServerName" />
</LoadBalancer>
<Path>/register/documents/{docId}</Path> <!-- where {id} is the extracted variable from the Extract Variable policy -->
</HTTPTargetConnection>
</TargetEndpoint>
NOTE: Replace the TargetServerName with your target server thats configured to point to your Target
https://targethost.com/something/v1/register/employer/{employer-id}/documents/{id}
i have extracted employer-id using URLPath ExtractPolicy. and used it to make some validation. Once validations are done, i dont need to send this /employer/{employer-id} to be sent to backend service as, backend service mapping is as below.
https://targethost.com/something/v1/register/documents/{id}
so how i can remove this from the path?
like Sai already suggested:
<TargetEndpoint name="default">
<HTTPTargetConnection>
<LoadBalancer>
<Server name="targetServerName" />
</LoadBalancer>
<Path>/something/v1/register/documents/{docId}</Path>
</HTTPTargetConnection>
</TargetEndpoint>