This topic describes the request parameters, response parameters, judgments, and calls of HTTP functions in a custom runtime.

Background information

Function Compute forwards your request including the Path, Body, and Common Header fields to the HTTP server. Unlike event functions, HTTP functions enable you to migrate existing HTTP web applications. You do not need to forward requests such as /invoke and /initialize to the HTTP server.

Input parameters of functions

  • event: the body of the POST request
  • context:
    • The x-fc-access-key-id, x-fc-access-key-secret, and x-fc-security-token headers are used to obtain temporary credentials for the service role to access other Alibaba Cloud services.
    • The x-fc-request-id header is used to obtain the current request ID.
    • For more information about request headers, see Common headers.

Function response structure

The results of a function call are returned as an HTTP response.

Function judgment

In a custom runtime, you can distinguish common calls from HTTP trigger calls based on the value of the x-fc-control-path field in the request header as follows:

  • /Invoke : The request is an event function call. In this case, Function Compute calls a function without using the HTTP trigger.
  • /Initialize : The request is an event function call. Before a function is called for the first time, Function Compute initializes the runtime environment.
  • /HTTP-invoke : The request is an HTTP function call. In this case, Function Compute uses the HTTP trigger to call a function. Function Compute forwards the user request (including the path, specific request header fields, and body) and common request header fields to the HTTP server in the custom runtime. After receiving the response header fields and body from the HTTP server, Function Compute returns the response to the client that makes the call request.


When an HTTP function is called, the client directly accesses the web API and the web page provided by your function. Therefore, you do not need to implement /invoke which is otherwise required when a non-HTTP function is called. The custom runtime receives other headers except common headers.

Header Description
x-fc-base-path If you do not configure a custom domain name, the value of x-fc-base-path is /2016-08-15/proxy/${servicename}/${functionname}/. You may need to set this value to the Path Base of a web application in the code. The process varies with languages or frameworks.