user963935
user963935

Reputation: 652

How to replace url path parameter

How to replace value of tenantId in the following url: /{tenantId}/users? I need to replace it with a value from jwt token. It's trivial for query param, but path params are not documented anywhere.

Upvotes: 0

Views: 1116

Answers (1)

DSpirit
DSpirit

Reputation: 2280

If I'm getting you right, you want to rewrite the uri in the inbound section? If your url is:

https://stackoverflow.com/{tenantId}/users

Then you can rewrite the Uri with following command:

<rewrite-uri template="@(context.Request.OriginalUrl.Path.Replace(context.Request.MatchedParameters["tenantId"], "<YOUR-JWT-TOKEN-VALUE>"))" copy-unmatched-params="true" />

Upvotes: 2

Related Questions