Giter Site home page Giter Site logo

ixti / api-umbrella-gatekeeper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nrel/api-umbrella-gatekeeper

0.0 3.0 0.0 10.07 MB

A component of API Umbrella. The gatekeeper is a custom reverse proxy that sits in front of your APIs and efficiently validates incoming requests.

Home Page: http://nrel.github.io/api-umbrella/

License: MIT License

JavaScript 100.00%

api-umbrella-gatekeeper's Introduction

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

api-umbrella-gatekeeper's People

Contributors

darylrobbins avatar gbinal avatar gui avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.