Files
doc-exports/docs/fg/umn/functiongraph_01_1442.html
liusiying01 904c1aad8b FG UMN 20250526 version
Reviewed-by: Mützel, Andrea <andrea.muetzel@t-systems.com>
Co-authored-by: liusiying01 <liusiying@huawei.com>
Co-committed-by: liusiying01 <liusiying@huawei.com>
2025-10-06 15:14:20 +00:00

32 KiB

Creating an HTTP Function

Overview

HTTP functions are designed to optimize web services and support multiple programming languages. You can send HTTP requests to URLs to trigger function execution.

Common Function Request Headers

The following table lists the default request header fields of an HTTP function.

Table 1 Default request header fields

Field

Description

X-CFF-Request-Id

ID of the current request

X-CFF-Memory

Allocated memory

X-CFF-Timeout

Function timeout duration

X-CFF-Func-Version

Function version

X-CFF-Func-Name

Function name

X-CFF-Project-Id

Project ID

X-CFF-Package

App to which the function belongs

X-CFF-Region

Current region

Constraints

  • HTTP functions do not distinguish between programming languages. The handler must be set in the bootstrap file. You can directly write the startup command, and allow access over port 8000. The bound IP address is 127.0.0.1.
  • The HTTP response body cannot exceed 6 MB.

    A valid HTTP function response must contain body(String), statusCode(int), headers(Map), and isBase64Encoded(boolean). By default, the response is encoded using Base64. The default value of isBase64Encoded is true. The same applies to other frameworks.

  • The bootstrap file is the startup file of the HTTP function. The HTTP function can only read bootstrap as the startup file name. If the file name is not bootstrap, the service cannot be started. For more information, see the bootstrap file example.

    If you run the JAR package, you are advised to add the JVM parameter -Dfile.encoding=utf-8 to bootstrap. Otherwise, garbled Chinese characters may be displayed.

  • Only APIG triggers can be created for HTTP functions.
  • HTTP functions cannot be executed for a long time, invoked asynchronously, or retried.
  • When a function initiates an HTTP request, the request IP address is dynamic for private network access and fixed for public network access. For more information, contact technical support.

Creating and Configuring an HTTP Function

The following uses an example to describe how to create and configure an HTTP function.

<script language="JavaScript"> </script>