API Gateway Sample REST Proxy

(1 review)

home

This proxy lets you offer to your customers capabilities that are not implemented in your API, without the need of adding a single line of code to it. In combination with API Policies and API Gateway, you can improve your security, enrich incoming messages, add troubleshooting features like logging, etc.

The proxy is a Mule application and as such, it can be only deployed to a Mule runtime.
Only the resources provided in your spec are the ones that will be handled and sent to the backend service.

Note: If your API is already a Mule based application, then instead of using a proxy, you can just include the autodiscovery capability to it.

What happens to a request that goes through the proxy?

  • The X-Forwarded-For header is included or updated.
  • All headers received are forwarded to the implementation API, except for the ones that mule includes (X-MULE-SESSION, X-MULE-ENCODING, etc).
  • All headers received from the implementation API are forwarded to the client.
  • Validation against your RAML (0.8/1.0) / OAS spec. This includes:

    • Headers
    • Uri parameters
    • Query parameters
    • Form parameters
    • Body (against JSON schema / XML schema / RAML type)
  • If your RAML spec specifies optional parameters with a default value, and the request does not provide that parameter, the proxy will add it.

Response status codeReason
400Bad request (Validation result)
404Not found (The resource could not be found in the RAML spec)
405Method not allowed (The method could not be found in the RAML spec)
504Gateway timeout

What else do you gain by using this type of proxy?

  • This proxy includes the API Console to test your requests. By default, you can find it by hitting “host_of_your_proxy:port_of_your_proxy/console”
  • This proxy has native OAS 2.0 support (yaml and json extensions).
  • This proxy has an improved and more precise RAML parser.
  • Users can leverage analytics information that is generated only if the API is tracked.You have the ability to apply API Gateway policies to it.

Validation properties

  • disableValidations: Used to enable/disable the validations of all the parameters and payload. Default value: false.
    • queryParamsStrictValidation: Used to limit the allowed parameters to those defined in the spec. Default value: false.
    • headersStrictValidation: Used to limit the allowed parameters to those defined in the spec. Default value: false.
  • keepApiBaseUri: When setting this property to true, it lets you retrieve the baseUri provided in the spec, when using the console. Otherwise, the console will display the baseUri of your local or CloudHub instance. Default value: false.

Reviews

TypeTemplate
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onFeb 6, 2024
Asset overview

Asset versions for 3.2.x

Asset versions
VersionActions
3.2.0

Categories

Functions
Enterprise ITNo values left to add