Azure API Management: Custom Policy for Request Size Validation optimization guide as Expected
I'm reviewing some code and I'm trying to implement a custom policy in Azure API Management to validate the size of incoming requests. I want to reject requests that exceed a specific size limit, but it seems the policy isn't functioning as intended. I’ve defined a policy like this: ```xml <inbound> <base /> <validate-content-length min-size="0" max-size="1048576" /> </inbound> ``` This policy is supposed to reject requests larger than 1MB. However, I’m still able to send a request with a body size of 2MB without receiving an behavior. I’ve verified that the policy is applied to the correct API and checked the policy order, which looks fine. I’ve also tried adding a `<return-response>` policy to provide feedback when a request is rejected, but that didn’t change the behavior either: ```xml <inbound> <base /> <validate-content-length min-size="0" max-size="1048576" /> <return-response> <set-status code="413" reason="Payload Too Large" /> <set-body>Request size exceeds the limit.</set-body> </return-response> </inbound> ``` I’m using Azure API Management version 2021-04-01, and I’m testing this with Postman by sending a raw JSON payload. Is there something I might be missing in the policy setup, or is there a different approach I should consider for enforcing request size limits? Any help would be appreciated! How would you solve this? This is part of a larger CLI tool I'm building. Any help would be greatly appreciated!