aneek / rate_limiter

Enables a rate limiting feature on each service request.
4 stars 2 forks source link

Rate Limiter

CONTENTS OF THIS FILE


Introduction

Rate Limiter module can be useful when to disallow concurrent web service access to the application.

Features

This module exposes a "Rate Limiting" service for RestAPI web service calls. This service features:

Requirements

Installation

Follow installation guide to install the module into the site.

Configuration

Navigate to Configuration >> Web services >> Rate Limiter Configuration (admin/config/services/rate-limiter). The configuration has two segments.

General Configuration has basic configurations to enable the module with allowed request limit in an allowed time frame. An optional message can be shown when the limit is reached.

Access Rules has two option to enable rate limiting service for all web-service request or based on IP. If IP based rate limiting is selected then there is an IP based white listing option available.

Assumptions

The following points were assumed while developing the module.

  1. Every Web-service call either have "Accept" header or "_format" query string.
  2. The Rate Limiting service will only work on requests with "application/json", "application/xml" and "application/hal+json" Accept headers or _format query string with "json", "hal_json" and "xml" values.
  3. Command line requests and "text/html" requests are considered as normal drupal requests to the site not as Service calls.
Caution

This module stores all it's rate limiter hit counts in Drupal's cache. So clearing cache will remove all the items. Assumed that in a production environment caches are not cleared more often.

Future Improvements

Maintainer(s)

Current maintainer
Change Log