All Products
Search
Document Center

Function Compute:Cloud-native API Gateway triggers

Last Updated:Apr 01, 2026

Use Cloud-native API Gateway as an event source for Function Compute. When a request reaches the gateway, it triggers the associated function to run and returns the result to the caller.

Only Function Compute 3.0 can be integrated with Cloud-native API Gateway.

How it works

Cloud-native API Gateway sits in front of your functions and handles routing, authentication, and traffic control. Unlike the classic API Gateway trigger, Cloud-native API Gateway does not distinguish between event functions and web functions — routing rules match incoming requests and forward them to Function Compute based on the path and domain you configure.

The request flow is:

  1. A client sends an HTTP request to the gateway's domain.

  2. The gateway matches the request against your routing rules and forwards it to Function Compute.

  3. Function Compute runs the function and returns the result.

  4. The gateway sends the response back to the client.

Prerequisites

Before you begin, ensure that you have:

  • A Function Compute 3.0 function. See Function creation

  • Access to Cloud-native API Gateway to create gateway instances, HTTP APIs, services, and routes

Integrate a function with Cloud-native API Gateway

Step 1: Create a function

Log on to the Function Compute console and create a function. For details, see Function creation.

Step 2: Set up a backend service

2.1 Create a gateway instance

Create a gateway instance in Cloud-native API Gateway. For details, see Create a gateway instance.

2.2 Create an HTTP API

Create an HTTP API under the gateway instance. For details, see Create an HTTP API.

2.3 Create a service

Create a service that points to your Function Compute function. For details, see Create a service.

image

2.4 Create a route

Create a route to connect the HTTP API to the backend service. For details, see Create a route.

Configure the following parameters. Leave the remaining parameters at their default values.

image
ParameterDescription
Domain NameThe domain used to access the service. The example.com shown in the figure is a placeholder — add and select your own domain.
PathThe routing path. Different paths trigger different functions.
Backend ServicesThe backend service you created in step 2.3.

2.5 Publish a routing rule

Publish the routing rule to make the route active. For details, see Publish a routing rule.

Step 3: Verify the integration

  1. Get the second-level domain name of the environment bound to the service.

  2. Call the published API. The following example uses curl:

    curl -i -X GET env-ct6ovnem1hknd****-cn-hangzhou.alicloudapi.com/fc

    A successful response looks like:

    HTTP/1.1 200 OK
    access-control-expose-headers: Date,x-fc-request-id
    content-disposition: attachment
    content-length: 11
    content-type: application/json
    x-fc-request-id: 1-674eae6c-15b2172f-7db950e70148
    date: Tue, 03 Dec 2024 07:08:28 GMT
    req-cost-time: 29
    req-arrive-time: 1733209708197
    resp-start-time: 1733209708226
    x-envoy-upstream-service-time: 28
    server: istio-envoy
    
    hello world

What's next