Reputation: 409
Is it possible to change a header of an API in wso2 api manager ? Suppose you have an API with the required header user-key:user-value and you want to change it to backend-key:user-value.
I want to know is this possible ?
Upvotes: 0
Views: 702
Reputation: 828
This can be done by writing a class mediator also. If there is a request that comes with backend-key header, you can get that and set that as the user-key header. This can be done by writing a class mediator. You can write the logic inside the mediator. Refer to this documentation https://apim.docs.wso2.com/en/latest/learn/api-gateway/message-mediation/adding-a-class-mediator/.
Upvotes: 0
Reputation: 4001
Using a custom sequence you can do this easily as follows.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="header_sequence">
<property name="user-value" expression="$trp:user-key"/>
<header name="backend-key" scope="transport" expression="get-property('user-value')"/>
<property name="user-key" scope="transport" action="remove"/>
</sequence>
Upvotes: 1