tencent cloud

Web Application Firewall

Traffic Onboarding

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-11-19 16:21:13
Traduzido e Verificado por IA

Feature Overview

Traffic onboarding, also known as domain onboarding, refers to connecting the LLM business domain to WAF through CNAME resolution or CLB listener mounting, so that HTTP/HTTPS traffic (including SSE streaming) accessing LLM APIs passes through WAF inspection. After the access is completed, you can configure policies for compute consumption, prompt injection, content security, and sensitive information identification for LLM APIs under the domain in the WAF console without modifying business code.
Compared with SDK/API Integration, traffic onboarding has the following characteristics:
Easy access: Access is completed by modifying DNS resolution or mounting a CLB listener, and business code generally requires no changes.
SSE streaming support: Provides dedicated SSE protocol access capabilities for Server-Sent Events long-connection scenarios of LLMs.
Integration with CLB: Users who already use Tencent Cloud CLB (Layer 7 load balancing) can easily connect CLB backend traffic to WAF and enable LLM security.
Session-level aggregation: Multi-turn conversation contexts are aggregated based on Session Identifier, supporting context-aware detection and rate limiting.

Scenario

This document describes how to connect your LLM business to the WAF LLM security module through traffic onboarding, and how to configure two basic business parameters: Session Identifier and Large Model Protection Path, enabling WAF to correctly identify LLM traffic and perform security inspection.
Applicable scenarios:
The LLM business is deployed under an independent domain, and you can modify DNS resolution or have already used Tencent Cloud CLB.
You can centrally manage LLM security policies without modifying business code.
Business scenarios primarily involve plain text conversations (with no current need for image or other multimodal detection).
Inapplicable scenarios (use SDK/API Integration instead):
The LLM business is deployed outside Tencent Cloud or on a self-built AI Agent, and you do not want to migrate the domain.
Requires multimodal (image) content security detection.

Prerequisites

The LLM security feature is an add-on service and must be purchased separately. You can go to the LLM Security page and click Activate now to view details and the ordering process. For detailed pricing, see Billing Overview.

Operation Step

Currently, the LLM security module supports access enablement for both SaaS WAF and cloud-native WAF.

Step 1: Confirm That the Domain Name Is Connected to WAF

If the business domain has not been connected to WAF, complete domain access first:
SaaS WAF: See SaaS WAF Connection.
Cloud-native WAF: See Cloud-native WAF Connection.
Note:
If the LLM uses the SSE (Server-Sent Events) protocol for business interaction, WAF can perform security inspection on computing power consumption, request content, and response content. If the LLM does not use the SSE protocol, WAF currently supports security inspection only on computing power consumption and request content.

Step 2: Configure the Session Identifier

LLM business interception requires risk identification and interception at the individual user level to apply different actions to different users under the same IP address. Therefore, you need to configure a Session Identifier.
1. Log in to the WAF console and choose LLM Security > Security Configurations in the left sidebar.
2. On the Security Configurations page, select the target domain that has been connected, and click Session Identification Settings to configure it.
3. On the Session ID Settings page, click New to create a Session Identifier extraction configuration.
Note:
The Session Identifier should be a continuously recordable Token ID, such as the value of Set-Cookie after login.
4. In the Add Session Identifier window, configure the relevant parameters and click OK.
Field Name
Description
Session Identifier Name
Custom identifier name, supporting up to 128 characters.
Session Identifier Description
Custom identifier description, supporting up to 128 characters.
Session Identifier Location
Specify the parameter name that identifies a specific location (QUERY, BODY, COOKIE, or HEADERS) as the session identifier, and use the value corresponding to that parameter name as the Session Identifier.
Session Identifier Parameter
Value identifier, which separates parameters at each level with the . character. Example:
test: Identify the value of the test parameter in the JSON string as the Session Identifier.
test1.test2: Identify the value of the test2 parameter contained in test1 in the JSON string as the session ID.
Disable Nested Parsing
After this feature is enabled, the system identifies test1.test2 as a single parameter name. By default, the system enables nested parsing for QUERY, BODY, and HEADERS. COOKIE does not support nested parsing. Nested parsing for HEADERS cannot be disabled, while nested parsing for QUERY and BODY can be disabled as needed.
Priority
Supports entering an integer from 1 to 100. A smaller value indicates a higher priority, and the session identifier configured with a higher priority is matched first. When priorities are the same, the one with a later update time takes precedence.
Set As Default
Supports setting a default session identifier. After the default is set, the session identifier configuration is used by default for extraction when a security policy is created.
Note:
After the configuration is complete, the Session Identifier will be displayed in the Session Identification Settings list. You can view, edit, or delete configured Session Identifiers in the list.

Step 3: Configure the Large Model Protection Path

Because different LLMs have different protection paths and corresponding Prompt and Response field locations, you need to specify the path and fields from which WAF should extract content for matching. Therefore, you need to define a specific protection path for the connected LLM business.
1. Log in to the WAF console and choose LLM Security > Security Configurations in the left sidebar.
2. On the Security Configurations page, select the target domain that has been connected, and click Large Model Protection Path Settings to configure it.
3. Click New and enter the path parameters in the Add Protection Path window.
One-click identification: Open the business website, press F12 to enable browser developer tools, initiate a conversation request, and then copy the corresponding CURL and Response Value from the network request. Paste them into the corresponding input boxes, click Identify and Extract, and the system will automatically parse and fill in the four parameters: Request Path, Prompt Content Position, Respond Position, and Position of Token Amount.
Manual entry: Configure the relevant parameters by referring to the parameter descriptions below.
Field Name
Description
Large Model Type
The system has built in some standard LLM path parameters. Select and fill them based on your LLM backend service type, or select custom filling.
Business Name
Limit the LLM service name to 128 characters. It is used for display and selection on the rule configuration page.
Request path
Configure the request path of the LLM service, for example, /v1/chat. Limit it to 128 characters.
Prompt Content Position
Configure the prompt field of the LLM service. You can use a parameter name or an array format. For example:
Configuring prompt means extracting the parameter value of prompt.
Configuring content.0.prompt means extracting the prompt parameter value of the first element in the content array.
Configuring content|@reverse|0.prompt means extracting the prompt parameter value of the last element in the content array.
Limited to 128 characters.
Note:
When continuous conversation detection is disabled, the input format is content.0.prompt (detects the first one) or content|@reverse|0.prompt (detects the last one).
When continuous conversation detection is enabled, the input format is content.#.prompt (detects from the first one) or content.#reverse.prompt (detects in reverse order, starting from the last one).
Continuous Conversation Detection
After this feature is enabled, WAF extracts the latest N rounds of prompt content based on the configured prompt position and sends the content to the prompt injection detection model for detection. If any round of conversation is matched, it is considered an attack. This feature is disabled by default.
Maximum Detection Dialogue Round
Set the maximum number of turns for continuous conversation content detection. Valid values range from 1 to 20, and the default value is 5. This setting takes effect only after Continuous Conversation Detection is enabled.
Thinking Position
If the LLM service is a reasoning model, configure the thinking content field of the LLM service here. Parameter names or array formats are supported, for example:
If thinking is configured, the value of the thinking parameter is extracted.
If content.0.thinking is configured, the value of the thinking parameter of the first element in the content array is extracted.
If content|@reverse|0.thinking is configured, the value of the thinking parameter of the last element in the content array is extracted.
Limited to 128 characters.
Response Position
Configure the response content field of the LLM service. Parameter names or array formats are supported. For example:
Configure response to extract its parameter value.
Configure content.0.response to extract the response parameter value of the first element in the content array.
Configure content|@reverse|0.response to extract the response parameter value of the last element in the content array.
Limit to 128 characters.
Position of Token Amount
Configure the field corresponding to the token usage of the customer's LLM service. Limit it to 128 characters. You can choose from three configuration methods:
Built-in token algorithm: When this option is selected, the WAF built-in algorithm is called to calculate the token.
Single field: When this option is selected, the value of this field in each request is read and aggregated to calculate the total token quantity.
Multiple fields: When this option is selected, the values of the request and response fields in each request are read and added together as the total token value for a single request.
Priority
Configure the priority. Priority logic: Enter an integer from 1 to 100. A smaller value indicates a higher execution priority for this rule. When priorities are the same, a later update time indicates a higher priority.
4. Verify the backfilled or entered parameters and click OK.
Note:
After the configuration is completed, the LLM protection path will be displayed in the LLM protection path setting list. WAF extracts the LLM interaction content for security detection based on the configured path and fields.

Subsequent Operation Steps

After traffic access is completed, you can go to the LLM Security > Security Configurations page to configure compute consumption rules and custom protection rules.

Traffic Onboarding Example

1. Taking the Demo business as an example, the fields corresponding to the request, response, and Token usage are as follows:
Request

Response time

Token consumption: The total consumption of a single field.

2. On the LLM Security > Security Configurations page, click Large Model Protection Path Settings. The corresponding LLM protection path configuration is as follows:

Field Name
Description
Prompt Content Position
The configuration value is messages|@reverse|0.content. It means the value of the content field in the latest element (in reverse order) of the messages array in the request payload.
Response Position
The configuration value is choices.0.delta.content. It means the value of the content field in the delta object of the first element in the choices array in the response data.
Position of Token Amount
The configuration value is usage.total_tokens. It means using the value of the total_tokens field in the usage object as the calculated value for Token consumption.

Ajuda e Suporte

Esta página foi útil?

comentários