blob: 52d862303f23784536254f1667e5c35221784d37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
=encoding utf-8
=head1 NAME
ngx_stream_ssl_preread_module - Module ngx_stream_ssl_preread_module
=head1
The C<ngx_stream_ssl_preread_module> module (1.11.5) allows
extracting information from the
L<ClientHello|https://datatracker.ietf.org/doc/html/rfc5246#section-7.4.1.2>
message without terminating SSLE<sol>TLS,
for example, the server name requested through
L<SNI|https://datatracker.ietf.org/doc/html/rfc6066#section-3>
or protocols advertised in
L<ALPN|https://datatracker.ietf.org/doc/html/rfc7301>.
This module is not built by default, it should be enabled with the
C<--with-stream_ssl_preread_module>
configuration parameter.
=head1 Example Configuration
Selecting an upstream based on server name:
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;
}
Selecting an upstream based on protocol:
map $ssl_preread_alpn_protocols $proxy {
~\bh2\b 127.0.0.1:8001;
~\bhttp/1.1\b 127.0.0.1:8002;
~\bxmpp-client\b 127.0.0.1:8003;
}
server {
listen 9000;
proxy_pass $proxy;
ssl_preread on;
}
Selecting an upstream based on SSL protocol version:
map $ssl_preread_protocol $upstream {
"" ssh.example.com:22;
"TLSv1.2" new.example.com:443;
default tls.example.com:443;
}
# ssh and https on the same port
server {
listen 192.168.0.1:443;
proxy_pass $upstream;
ssl_preread on;
}
=head1 Directives
=head2 ssl_preread
B<syntax:> ssl_preread I<C<on> E<verbar> C<off>>
B<default:> I<off>
B<context:> I<stream>
B<context:> I<server>
Enables extracting information from the ClientHello message at
the L<preread|stream_processing> phase.
=head1 Embedded Variables
=over
=item C<$ssl_preread_protocol>
the highest SSL protocol version supported by the client (1.15.2)
=item C<$ssl_preread_server_name>
server name requested through SNI
=item C<$ssl_preread_alpn_protocols>
list of protocols advertised by the client through ALPN (1.13.10).
The values are separated by commas.
=back
|