-
Notifications
You must be signed in to change notification settings - Fork 5
Nginx Module Options
Syntax: smockron [on|off]
Default: off
Context: http, server, location
Enables or disables rate-limiting for a given block. Smockron will not process requests in a block where it is disabled.
Syntax: smockron_master scheme://server:port
Default: tcp://localhost:10004
Context: http, server, location
The location of the smockron master server to connect to. Must follow the rules of a ZeroMQ connection string and must include a port number. The accounting connection will be made on the named port, and the control connection will be made on the port one higher.
Syntax: smockron_domain domainname
Default: default
Context: http, server, location
The smockron domain for requests to this block. Domains allow a smockron server to control access to more than one resource; resources which should be rate-limited independently should have different domains.
Syntax: smockron_identifier $variable
Default: $remote_addr
Context: http, server, location
Specifies the variable used to identify clients for rate limiting. $remote_addr
is a good default, but you might want to use something like $http_x_real_ip
if behind a proxy, or a custom variable containing an API key. An identifier of ""
or any constant string allows you to limit the total traffic to a resource.
Syntax: smockron_log_info $variable
Default: none
Context: http, server, location
A variable containing extra info to send to the smockron master for logging. Unset by default, and currently the master does nothing with this information.
Syntax: smockron_max_delay msec
Default: 5000
Context: http, server, location
The maximum time to delay a request before rejecting it. If a client's next request will be allowed less than smockron_max_delay milliseconds in the future it will be delayed until that time; otherwise it will be rejected.
Syntax: smockron_status_code code
Default: 503
Context: http, server, location
The status code to use for rejected requests. The default, 503, is encouraged by the HTTP RFC for an overloaded server. Can be used in connection with the nginx error_page
option.
Syntax: smockron_shm_size nnn[K|M]
Default: 4M
Context: http
The size of the shared memory area used to store throttled clients for the entire server. The default should be enough for a moderately busy server, but if you receive "Allocating delay failed, increase smockron_shm_size" or "HASH_ADD_STR failed, increase smockron_shm_size" messages, then increase this value until they go away. If the shared memory area becomes full, additional clients can't be throttled, and will be allowed access.