Flex Gateway, Getting started

Artyom Subbotin
MuleSoft Architect

Anypoint Platform now offers three different gateway options for managing and securing your APIs:

  • Mule Gateway. Mule Runtime includes an embedded API Gateway. Using this gateway, any user can, for example, apply a basic authentication policy on top of a Mule application or enrich an incoming/outgoing message, without having to write any code.

  • Anypoint Service Mesh. Anypoint Service Mesh enables you to extend Anypoint Platform API Management capabilities to your Istio service mesh y deploying a Mule Adapter. Once installed, you can manage and secure your distributed applications running within your Istio service mesh seamlessly from a single pane.

  • Flex Gateway. Anypoint Flex Gateway is MuleSoft’s new API gateway offering to manage and secure APIs running anywhere (cloud, on-premise) in any tech stack (java, .net, python, etc). With the new Anypoint flex gateway, Organizations will be able to manage and govern all the APIs under one roof.

Why Flex Gateway?

It’s ultrafast, designed to manage and secure APIs running anywhere. Built to integrate seamlessly with DevOps and CI/CD workflows, Anypoint Flex Gateway delivers the performance required for the most demanding applications while providing enterprise security and manageability across any environment.

What are the benefits of Flex Gateway?

  • Easily manage all the APIs within your organization from a single platform and under a single umbrella.

  • Extend the Anypoint Platform Capabilities to Mule and non-Mule APIs.

  • Secure, discover, govern, or engage the APIs (Mule and non-Mule APIs).

  • Adapt any architecture with a lightweight and flexible API Gateway to manage and secure the APIs.

Configuration modes

Anypoint Flex Gateway can be run in two ways:

  • Connected Mode – API management is done using the Anypoint control plane in this mode.

  • Local Mode – API Management is done locally using stored configuration files.

Feature comparing for Connected and Local Modes:

How to use Flex Gateway

According to documentation Flex Gateway can be set up on three different operating systems:

  • Install Flex Gateway as a Linux Service.

  • Install Flex Gateway as a Docker Container.

  • Install Flex Gateway as a Kubernetes Ingress Controller.

Generally, the process of deployment in different environments looks like in the picture below:

Let’s review the deployment steps for Flex Gateway as a Docker container:

Step 1 Prepare the environment
Before starting, it’s necessary to install Docker in your system. Right after that log into Anypoint Cloudhub and follow the instructions in the Runtime Manager -> Flex Gateway tab

Step 2 Install Flex Gateway Docker image

Step 3 Register your gateway

Verify that registration.yaml was created successfully

Step 4 Start the gateway

Verify in the console logs that gateway was started successfully

Step 5 Check the status of Flex Gateway from Anypoint platform

Step 6 Configure API using API Manager

  • Choose Flex Gateway runtime and create a replica

  • Select API which will work under Flex Gateway or create new one

  • Configure endpoint settings. Don’t forget to provide the implementation URL - over it, Flex Gateway will redirect the API request to the implementation URL. In the current example API is using https://sample-api-sandbox.de-c1.cloudhub.io/api url as primary

  • Review configuration and deploy instance

Step 7 Test deployed API
Try to send Postman requests according to previous configurations

Step 8 Apply policies

  • Add “Basic Authentication” policy to the API in API Manager

  • Test API with applied Auth policy using Postman. Try to send a request without adding Authorization - you will see the appropriate exception

  • After adding Authorization details everything should works as expected