Validate - Limit Request Size (API Definition) Tyk Operator

To validate the max size of the incoming request, Tyk operator provides support through API Definitions and support information is captured in below documentation.

But sample YAML provided for Validate - Limit Request Size feature has json validation details. Can you help providing the API definition details for max size validation feature.

https://github.com/TykTechnologies/tyk-operator/blob/master/config/samples/httpbin_validate.yaml

Apologies - this looks like a typo.

Here is an example:

apiVersion: tyk.tyk.io/v1alpha1
kind: ApiDefinition
metadata:
  name: httpbin-limit
spec:
  name: httpbin-limit
  use_keyless: true
  protocol: http
  active: true
  proxy:
    target_url: http://httpbin.org
    listen_path: /httpbin-limit
    strip_listen_path: true
  version_data:
    default_version: Default
    not_versioned: true
    versions:
      Default:
        name: Default
        use_extended_paths: true
        extended_paths:
          size_limits:
            - method: POST
              path: /post
              size_limit: 5

Then putting it in action

curl http://YOURURL/httpbin-limit/post -X POST -d '123456'
{
    "error": "Request is too large"
}

Thank you ahmet. It worked fine now.

1 Like