For that reason we separate the API gateway configuration from any existing (or future) configuration for browser‑based traffic. However, some of the default behavior expected of an API gateway differs from that expected for browser‑based traffic. If NGINX is already part of your application delivery stack then it is generally unnecessary to deploy a separate API gateway. One advantage of using NGINX as an API gateway is that it can perform that role while simultaneously acting as a reverse proxy, load balancer, and web server for existing HTTP traffic. API gateway architecture for multiple applications Organizing the NGINX Configuration So the API’s path structure is: apiĪs an example, to query the current warehouse inventory, a client application makes an HTTP GET request to /api/warehouse/inventory. The inventory and pricing resources are implemented as separate services and deployed to different backends. The Warehouse API is implemented as a collection of discrete microservices and published as a single API. The use of JSON is not, however, a limitation or requirement of NGINX when deployed as an API gateway NGINX is agnostic to the architectural style and data formats used by the APIs themselves. The Warehouse API is a RESTful API that consumes JSON requests and produces JSON responses. We use sample configuration code to illustrate different use cases. In this blog post we refer to a hypothetical API for inventory management, the “Warehouse API”. Our API gateway needs to manage existing APIs, monoliths, and applications undergoing a partial transition to microservices. Not all APIs are microservices applications. The primary function of the API gateway is to provide a single, consistent entry point for multiple APIs, regardless of how they are implemented or deployed at the backend. We describe a complete configuration, which can form the basis of a production deployment. In this blog post we describe a number of common API gateway use cases and show how to configure NGINX to handle them in a way that is efficient, scalable, and easy to maintain. This makes NGINX the ideal platform with which to build an API gateway. By using HTTP, the advancements in web application delivery that support hyperscale Internet properties can also be used to provide reliable and high‑performance API delivery.įor an excellent introduction to the importance of API gateways for microservices applications, see Building Microservices: Using an API Gateway on our blog.Īs the leading high‑performance, lightweight reverse proxy and load balancer, NGINX has the advanced HTTP processing capabilities needed for handling API traffic. The HTTP API provides a common interface, regardless of the scale of the application, from a single‑purpose microservice to an all‑encompassing monolith. HTTP enables applications to be built rapidly and maintained easily. For ease of reading, the rest of the blog refers simply to “NGINX”.Īt the heart of modern application architectures is the HTTP API. Note: Except as noted, all information in this post applies to both NGINX Open Source and NGINX Plus. Part 3 explains how to deploy NGINX Open Source and NGINX Plus as an API gateway for gRPC services.Part 2 extends those use cases and looks at a range of safeguards that can be applied to protect and secure backend API services in production.Originally published in 2018, it has been updated to reflect current best practice for API configuration, using nested location blocks to route requests, instead of rewrite rules. This post provides detailed configuration instructions for several use cases.This is the first blog post in our series on deploying NGINX Open Source and NGINX Plus as an API gateway:
0 Comments
Leave a Reply. |