This topic describes the request parameters, response parameters, judgments, and calls of HTTP functions in a custom runtime.
/initializeto the HTTP server.
Input parameters of functions
- event: the body of the POST request
- 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 request headers in Function Compute.
Function response structure
The results of a function call are returned as an HTTP response.
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.
|x-fc-base-path||If you do not configure a custom domain name, the value of x-fc-base-path is