Using long resource IDs or method names (for call or auth requests) may cause the NATS subject to exceed the maximum control line size, which in turn will disconnect Resgate from NATS.
This affects both requests through WebSocket as well as HTTP.
Solution
Add validation for the generated request subject + reply inbox subject to make sure the sum doesn't exceed NATS' default MAXIMUM_CONTROL_LINE_SIZE which is set to 4096 bytes. If it does, no NATS request should be made, and an error should be returned:
{ "code": "system.subjectTooLong", "message": "Subject too long" }
In case of HTTP requests, the status code would be:
414 URI Too Long
Note
Max length of a resource ID remains unspecified by RES protocol
The limitation does not include queries, as they are sent in the NATS request body instead of being part of the subject
Issue
Using long resource IDs or method names (for call or auth requests) may cause the NATS subject to exceed the maximum control line size, which in turn will disconnect Resgate from NATS.
This affects both requests through WebSocket as well as HTTP.
Solution
Add validation for the generated request subject + reply inbox subject to make sure the sum doesn't exceed NATS' default
MAXIMUM_CONTROL_LINE_SIZE
which is set to 4096 bytes. If it does, no NATS request should be made, and an error should be returned:In case of HTTP requests, the status code would be:
Note