Regular - General Flow

With this API, you send a request to the Gateway, which authorizes and forwards it to the configured backend service.

Prerequisites

  • Before calling this API, ensure you have created and activated a Tenant whose appId matches the App-Id header of this request. The correct appId value can be retrieved from the TenantResource returned by the Dashboard API.
  • You must also have created and activated a REGULAR type Route whose appRouteId matches the App-Route-Id header, and whose HTTP method and path match those of this request. The correct appRouteId value can be retrieved from the RouteResource returned by the Dashboard API.
📘

One REGULAR Route for Each Backend Endpoint

For each endpoint that the Gateway must forward to your backend, you must create a corresponding REGULAR type Route.

For example, if your backend exposes GET/product and GET/order, you must create two REGULAR type Routes: one for GET/product and one for GET/order.

Base URL

https://your-gateway-host

Required Headers

App-Id: app-xxxxxxxx
App-Key: key-xxxxxxxx
App-Route-Id: route-xxxxxxxx

Optional Headers

Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Client Headers

Any additional headers added by you on the client side will be forwarded to the backend service, except for headers that can not be forwarded according to the HTTP specification, such as hop-by-hop headers.

📘

The App-Id, App-Key, App-Route-Id, and Authorization headers are not forwarded to the backend service. These headers are intended for communication with the Gateway only and are excluded from the forwarded request to prevent exposing sensitive credentials.

Gateway-Managed Headers

Headers configured in RouteConfig.customHeaders are added automatically by the Gateway when forwarding the request to the backend service.

📘

You must not add these headers to your client request, as they are intended to be set by the Gateway in the request to the backend.

RouteConfig.customHeaders may include API keys or Basic Authentication credentials used by the Gateway to authenticate with the backend.

Method and Path

Use the HTTP method and path specified in the activeConfig field of the Route.

Both method and path will be forwarded to the backend service.

If the Route path contains a dynamic path placeholder, make sure to replace it with an actual value before making the request.

For example:

GET /product/{id}

becomes:

GET /product/123

Query Parameters

You can add any query parameters to the request. They will be forwarded to the backend service.

Request Body: Client to Gateway

You can include any custom JSON body in the request to the Gateway, which we refer to as the payload.

Request Body: Gateway to Backend

The Gateway forwards the following JSON object to the backend service:

{
  "user": {
    "username": "username",
    "authorities": ["USER"],
    "data": { },
    "confirmed": true
  },
  "payload": { }
}
  • user contains the authenticated user derived from the access token, if the Route is configured to require authentication and to forward the user to the backend:
    • RouteConfig.auth.isRequired = true
    • RouteConfig.forwardUser = true
  • payload contains the custom JSON body provided in the request to the Gateway.
📘

If no user and no payload are forwarded, the Gateway sends the request to the backend without a request body.

Response

The Gateway forwards the response from the backend service directly to the client.

Request Flow


Did this page help you?