Skip to Content

Character Limit

Limit number of characters in a GraphQL query document.

This plugin helps you to prevent DoS attacks by hard-limiting the size of the query document.

Provided by GraphQL Armor

How to use?

Install the plugin:

npm install @escape.tech/graphql-armor-character-limit

Then, add it to your plugins:

gateway.config.ts
import { characterLimitPlugin } from '@escape.tech/graphql-armor-character-limit' import { defineConfig } from '@graphql-hive/gateway' export const gatewayConfig = defineConfig({ plugins: () => [ characterLimitPlugin({ maxLength: 15000 // Number of characters allowed | Default: 15000 }) ] })
💡
  • We recommend using the Max Tokens Plugin instead of this one. - This plugin does not limit the size of input variables. - This plugin relies on a parser plugin to works and access query document through the context.
Last updated on