An Azure service that provides a hybrid, multi-cloud management platform for APIs.
Hi @Sairam Ganji ,
Thanks for reaching out to Microsoft Q&A.
Currently, it seems that APIM does have some limitations regarding modifying certain headers. Specifically, headers such as X-Forwarded-For may be preserved for various routing scenarios and might not be easily removed using the standard policies you've mentioned.
You could add a <set-header> policy to explicitly override the X-Forwarded-For header in the inbound policy section. It should look something like this:
<inbound>
<set-header name="X-Forwarded-For" exists-action="override">
<value></value>
</set-header>
</inbound>
Ensure that the policy to remove the header is placed before any policies that may be appending or preserving headers, such as the <set-backend-service>. The order of execution is crucial in APIM.
Use APIM's "Effective Policy" feature to check if there are other policies influencing this behavior. You can calculate the effective policy at the operation level to see if headers are being modified elsewhere.
Ensure that your backend SMS provider isn't also set to expect X-Forwarded-For headers. Sometimes backend services might override the incoming headers.
Hope this helps!
If the resolution was helpful, kindly take a moment to click on
and click on Yes for was this answer helpful. And, if you have any further query do let us know.