You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/rule-engines/javascript.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Your JavaScript can return:
48
48
-**Boolean**: `true` to allow, `false` to deny
49
49
-**Object with message**: `{allow: false, deny_message: "Custom error"}`
50
50
-**Just a message**: `{deny_message: "Blocked"}` (implies deny)
51
-
-**Object with byte limit**: `{allow: {max_tx_bytes: 1024}}` (allow but limit request upload to N bytes)
51
+
-**Object with byte limit**: `{allow: {max_tx_bytes: 1024}}` (allow but limit request upload to N bytes, returns 413 if Content-Length exceeds limit)
52
52
53
53
```javascript
54
54
// Simple boolean
@@ -147,6 +147,10 @@ uploadHosts.includes(r.host)
147
147
:r.host.endsWith('.example.com')
148
148
```
149
149
150
+
**Behavior:**
151
+
- If the request includes a `Content-Length` header that exceeds the limit, the client receives a `413 Payload Too Large` error immediately without contacting the upstream server
152
+
- If no `Content-Length` header is present (e.g., chunked encoding), the request body is truncated at the limit as it streams to the upstream server
Copy file name to clipboardExpand all lines: docs/guide/rule-engines/line-processor.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ Your processor must respond with one line per request:
32
32
-**Boolean strings**: `"true"` (allow) or `"false"` (deny)
33
33
-**JSON object**: `{"allow": false, "deny_message": "Blocked by policy"}`
34
34
-**JSON with message only**: `{"deny_message": "Blocked"}` (implies deny)
35
-
-**JSON with byte limit**: `{"allow": {"max_tx_bytes": 1024}}` (allow but limit request upload to N bytes)
35
+
-**JSON with byte limit**: `{"allow": {"max_tx_bytes": 1024}}` (allow but limit request upload to N bytes, returns 413 if Content-Length exceeds limit)
36
36
-**Any other text**: Treated as deny with that text as the message (e.g., `"Access denied"` becomes a deny with message "Access denied")
37
37
38
38
## Command Line Usage
@@ -66,6 +66,8 @@ for line in sys.stdin:
66
66
print("true")
67
67
elif req['host'] in upload_hosts:
68
68
# Limit upload endpoints to 1KB requests
69
+
# Returns 413 error if Content-Length exceeds limit
0 commit comments