Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nginx
GitHub Repository: nginx/nginx.org
Path: blob/main/xml/en/docs/stream/stream_processing.xml
1 views
1
<!--
2
Copyright (C) Nginx, Inc.
3
-->
4
5
<!DOCTYPE article SYSTEM "../../../../dtd/article.dtd">
6
7
<article name="How nginx processes a TCP/UDP session"
8
link="/en/docs/stream/stream_processing.html"
9
lang="en"
10
rev="4">
11
12
<section>
13
14
<para>
15
A TCP/UDP session from a client is processed
16
in successive steps called <b>phases</b>:
17
18
<list type="tag">
19
20
<tag-name id="postaccept_phase">
21
<literal>Post-accept</literal>
22
</tag-name>
23
<tag-desc>
24
The first phase after accepting a client connection.
25
The <link doc="ngx_stream_realip_module.xml">ngx_stream_realip_module</link>
26
module is invoked at this phase.
27
</tag-desc>
28
29
<tag-name id="preaccess_phase">
30
<literal>Pre-access</literal>
31
</tag-name>
32
<tag-desc>
33
Preliminary check for access.
34
The
35
<link doc="ngx_stream_limit_conn_module.xml">ngx_stream_limit_conn_module</link>
36
and
37
<link doc="ngx_stream_set_module.xml">ngx_stream_set_module</link>
38
modules are invoked at this phase.
39
</tag-desc>
40
41
<tag-name id="access_phase">
42
<literal>Access</literal>
43
</tag-name>
44
<tag-desc>
45
Client access limitation before actual data processing.
46
At this phase,
47
the <link doc="ngx_stream_access_module.xml">ngx_stream_access_module</link>
48
module is invoked,
49
for <link doc="../njs/index.xml">njs</link>,
50
the <link doc="ngx_stream_js_module.xml" id="js_access"/> directive
51
is invoked.
52
</tag-desc>
53
54
<tag-name id="ssl_phase">
55
<literal>SSL</literal>
56
</tag-name>
57
<tag-desc>
58
TLS/SSL termination.
59
The <link doc="ngx_stream_ssl_module.xml">ngx_stream_ssl_module</link>
60
module is invoked at this phase.
61
</tag-desc>
62
63
<tag-name id="preread_phase">
64
<literal>Preread</literal>
65
</tag-name>
66
<tag-desc>
67
Reading initial bytes of data into the
68
<link doc="ngx_stream_core_module.xml" id="preread_buffer_size">preread buffer</link>
69
to allow modules such as
70
<link doc="ngx_stream_ssl_preread_module.xml">ngx_stream_ssl_preread_module</link>
71
analyze the data before its processing.
72
For <link doc="../njs/index.xml">njs</link>,
73
the <link doc="ngx_stream_js_module.xml" id="js_preread"/> directive
74
is invoked at this phase.
75
</tag-desc>
76
77
<tag-name id="content_phase">
78
<literal>Content</literal>
79
</tag-name>
80
<tag-desc>
81
Mandatory phase where data is actually processed, usually
82
<link doc="ngx_stream_proxy_module.xml">proxied</link> to
83
<link doc="ngx_stream_upstream_module.xml">upstream</link> servers,
84
or a specified value
85
is <link doc="ngx_stream_return_module.xml">returned</link> to a client.
86
For <link doc="../njs/index.xml">njs</link>,
87
the <link doc="ngx_stream_js_module.xml" id="js_filter"/> directive
88
is invoked at this phase.
89
</tag-desc>
90
91
<tag-name id="log_phase">
92
<literal>Log</literal>
93
</tag-name>
94
<tag-desc>
95
The final phase
96
where the result of a client session processing is recorded.
97
The <link doc="ngx_stream_log_module.xml">ngx_stream_log_module</link>
98
module is invoked at this phase.
99
</tag-desc>
100
</list>
101
102
</para>
103
104
</section>
105
106
</article>
107
108