# ngx\_stream\_ssl\_preread\_module

* [示例配置](/nginx-docs/he-xin-gong-neng/stream/ngx_stream_ssl_preread_module.md#example_configuration)
* [指令](/nginx-docs/he-xin-gong-neng/stream/ngx_stream_ssl_preread_module.md#directives)
  * [ssl\_preread](/nginx-docs/he-xin-gong-neng/stream/ngx_stream_ssl_preread_module.md#ssl_preread)
* [内嵌变量](/nginx-docs/he-xin-gong-neng/stream/ngx_stream_ssl_preread_module.md#embedded_variables)

`ngx_stream_ssl_preread_module` 模块（1.11.5）允许从 [ClientHello](https://github.com/DocsHome/nginx-docs/tree/f6135c42a499e9fab0adb433738fcf8cd4041627/模块参考/stream/ClientHello/README.md) 消息中提取信息，而不会终止 SSL/TLS，例如提取通过 [SNI](https://tools.ietf.org/html/rfc6066#section-3) 请求的服务器名称。默认情况下不构建此模块，您可以在构建时使用 `--with-stream_ssl_preread_module` 配置参数启用此模块。

## 示例配置 <a href="#example_configuration" id="example_configuration"></a>

```
map $ssl_preread_server_name $name {
    backend.example.com      backend;
    default                  backend2;
}

upstream backend {
    server 192.168.0.1:12345;
    server 192.168.0.2:12345;
}

upstream backend2 {
    server 192.168.0.3:12345;
    server 192.168.0.4:12345;
}

server {
    listen      12346;
    proxy_pass  $name;
    ssl_preread on;
}
```

## 指令 <a href="#directives" id="directives"></a>

### google\_perftools\_profiles

|       - | 说明                              |
| ------: | ------------------------------- |
|  **语法** | **ssl\_preread** `on` \| `off`; |
|  **默认** | ssl\_preread off;               |
| **上下文** | stream、server                   |

启用在[预读阶段](https://github.com/DocsHome/nginx-docs/tree/f6135c42a499e9fab0adb433738fcf8cd4041627/模块参考/stream/stream_processing.md#preread_phase) 从 ClientHello 消息中提取信息。

## 内嵌变量 <a href="#embedded_variables" id="embedded_variables"></a>

* `$ssl_preread_server_name`

  返回通过 SNI 请求的服务器名称

## 原文档

<http://nginx.org/en/docs/ngx_google_perftools_module.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docshome.gitbook.io/nginx-docs/he-xin-gong-neng/stream/ngx_stream_ssl_preread_module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
