Hi Team,
I found that by default, Apigee sent a default header and one of them is “date” header. I tried to remove that using JavaScript and AssignMessage policy in Response PostFlow but the header was still sent to the client. I need to remove this “date” header because the requirement needs another header name, let’s say “timestamp”, that contains the timestamp and it must be in ISO 8601 format.
JS code that I used
context.removeVariable('response.header.date');
AssignMessage Policy
<AssignMessage continueOnError="false" enabled="true" name="AM-RemoveDefaultHeader">
<DisplayName>AM-RemoveDefaultHeader</DisplayName>
<Remove>
<Headers>
<Header name="date"/>
</Headers>
</Remove>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="response"/>
</AssignMessage>
Proxy Flow
<PostFlow name="PostFlow">
<Request>
...
</Request>
<Response>
<Step>
<Name>JS-RemoveDefaultHeader</Name>
</Step>
<Step>
<Name>AM-RemoveDefaultHeader</Name>
</Step>
</Response>
</PostFlow>