4

Setting Payload limits to protect your apis in API Connect

 2 years ago
source link: https://chrisphillips-cminion.github.io/apiconnect/2022/09/07/configuring-apic-parsing-limit.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Setting Payload limits to protect your apis in API Connect

Setting Payload limits to protect your apis in API Connect

Sep 7, 2022 • Category APIConnect by Chris Phillips

In API Connect a parsing policy can be used to protect your apis to ensure that large files are not malicious or accidentally clogging up system, by default the max size is 4MB. However clients frequently want to support files larger then the default size, this is not something I recommend (I will make a future post about).

This post will show the steps to increase or decrease the document size limit.

Firstly, the document size limit is only applied when an API uses the parse policy. To apply the 4MB limit simply add the parse policy to the start of your API.

Now to customise the limit the parse-setting option must be modified on each DataPower. I recommend that this is via a gateway extension or added to an existing gateway extension.

The DataPower object looks like the below

parse-settings: apic-default-parsesettings [up]
-----------------------
 admin-state enabled
 document-type detect
 document-size 4194304 bytes
 nesting-depth 512
 width 4096
 name-length 256 bytes
 value-length 8192 bytes
 unique-prefixes 1024
 unique-namespaces 1024
 unique-names 1024
 number-length 128 bytes

To change the document size you must modify the document-size attribute. Please not the object does not exist until after the Gateway is registered with the API Manager.

The commands in data power are as follows to set the max size to 512kb

sw apiconnect
config
parse-settings apic-default-parsesettings
document-size 524288
exit
exit
write mem

I would recommend the following commands are added to a gateway extension if this is running with DataPower in a container.

top; co
parse-settings apic-default-parsesettings
document-size 524288

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK