Restricting payload content based upon consumer

Not applicable

What is the best approach to restrict payload content based upon consumer ,in APIGEE?

1 3 115
3 REPLIES 3

Can you elaborate on what you mean by "restrict payload content" ?

Do you mean, restrict the payload size?

the format?

the content-type?

Please provide more details.

@Dino ,I meant based upon payload size...

A really easy way is to attach a custom attribute to the developer app (== consumer). That attribute might be max-payload-size, and might hold values like 20kb or 10mb.

A runtime, check the actual content-length against the attribute value. Reject the request (maybe via RaiseFault) if the threshold is exceeded.

For chunked-encoding content, you have a different problem. There is no content-length header.

Let me research that scenario further.

At the moment, the one way I can see doing it, is to pipe the request through a nodejs endpoint which acts as a "filter". The nodejs endpoint can keep count of the data that has been streamed and if the bytecount exceeds the threshold, then the nodejs endpoint throws an exception.

That seems pretty clean.