Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A component of API Umbrella. The gatekeeper is a custom reverse proxy that sits in front of your APIs and efficiently validates incoming requests.
JavaScript

Merge pull request #20 from cmc333333/124-move-to-settings

Move rate_limit_bucket_name into an API setting
latest commit fab52f7b3d
@GUI GUI authored

README.md

API Umbrella Gatekeeper

API Umbrella Gatekeeper is a custom reverse proxy that sits in front of your APIs and efficiently validates incoming requests. It is part of the API Umbrella project. API Umbrella Gatekeeper is written in Node.js.

Issues for this project are maintained here.

Overview

The basic aim of the Gatekeeper is to handle API keys, throttle requests, gather analytics, and optionally rewrite requests before passing incoming requests to your actual APIs.

In the API Umbrella stack, the Gatekeeper is represented below:

[request] ==> [load balancer] ==> [GATEKEEPER] ==> [cache] ==> [load balancer] => [api backend]

Usage

See Running API Umbrella for setup instructions.

Features

API Key Validation

Once a request hits API Umbrella Gatekeeper, it validates that a valid API key has been passed with the request. If a valid API key is present, the request is allowed to hit the API backend (assuming the user has not exceeded their rate limits). If the API key is missing or invalid, then Gatekeeper immediately responds to the request and the request is not permitted to access the API backend.

API keys can be passed in three differnet, configurable ways:

  • HTTP header
  • GET parameter
  • HTTP basic username

Currently, only simple API keys are supported, but it would be possible to extend API Umbrella Gatekeeper to support OAuth2 or other authentication mechanisms.

API keys are stored in MongoDB.

Rate Limiting / Throttling

In addition to validating API keys, API Umbrella Gatekeeper also performs rate lmiting to ensure users don't overload your API backends. Rate limiting can be performed based on the users API key, IP address, or both. Rate limits can be configured in a number of ways:

  • Rate limit by API key, IP address, or both.
  • Rate limit by any arbitrary rolling time window (per 1 second, per 15 minutes, per hour, per day, etc).
  • Rate limits can be configured on a per API or per user basis.
  • Rate limits can be distributed and shared across hosting environemnts. This allowing for rate limits to still be efficiently applied if API Umbrella is distributed locally or geographically.

Rate limiting uses both Redis and MongoDB.

Logging & Analytics

Details on each incoming API request is asyncronously logged in a database to allow for near real time analytics of all your API usage. Various details are captured for each request:

  • Basic details like request URL.
  • Additional header information like,
  • Geographic information on where the request originated from.
  • Response codes from the API backend, so you can look for requests that resulted in errors.
  • Performance metrics: How long each request took to respond is captured, so you can see how your API performs and look for problem areas.
  • Size metrics: Keep track of how many bytes are trasnferred for the request and the response.

The API Umbrella Web application provides an administrative interface for browsing and querying the analtyics gathered.

Logs and analytics are gathered in ElasticSearch.

API Facade / Request Rewriting

API Umbrella Gatekeeper can optionally modify the incoming request in a variety of ways. This allows your public facing API to differ from the backend.

  • URL rewriting: The incoming URL can be transformed before hitting the backend. This can be as simple as presenting the API under a different URL prefix, or as complex as providing a completely different URL structure.
  • Manipulate HTTP headers: Add or remove HTTP headers from the request before it hits the API backend. You can also used Handlebars templates to dynamic set a header value based on the request coming in: x-original-proto: {{headers.x-forwarded-proto}}

The API Umbrella Web application provides an administrative interface configuring the API backends and performing common types of rewriting.

License

API Umbrella is open sourced under the MIT license.

Acknowledgements

Geographic data comes from GeoLite data created by MaxMind.

githalytics.com alpha

Something went wrong with that request. Please try again.