Skip to content

Instantly share code, notes, and snippets.

@jovemfelix
Created September 21, 2022 19:20
Show Gist options
  • Select an option

  • Save jovemfelix/c3515c76641a210ebd0f4881f43ce075 to your computer and use it in GitHub Desktop.

Select an option

Save jovemfelix/c3515c76641a210ebd0f4881f43ce075 to your computer and use it in GitHub Desktop.

lua code

$ cat <<EOF > custom-body-size-env.lua
io.output("/opt/app-root/src/apicast.d/body_size.conf")
io.write("client_body_buffer_size    2m;\n", "client_max_body_size    2m;\n")
io.close()
EOF

secret with LUA

$ oc create secret generic custom-body-size-env --from-file=./custom-body-size-env.lua

patch APIcast

spec:
  customEnvironments:
    - secretRef:
        name: custom-body-size-env

restart

$ oc delete secret custom-body-size-env --ignore-not-found=true; \
  oc create secret generic custom-body-size-env --from-file=./custom-body-size-env.lua; \
  oc delete pod -l deployment=apicast-redhat-teste-staging          

dummy payload of 3M

$ dd if=/dev/urandom of=./payload-3M.txt bs=3M count=1;

call API with 3MB

$ curl -k -i -X POST $API -H "Content-Type: text/xml" --data-binary "@payload-3M.txt"
HTTP/2 413
server: openresty
date: Wed, 21 Sep 2022 19:12:41 GMT
content-type: text/html
content-length: 180

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>openresty</center>
</body>
</html>

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment