Skip to content

Commit 80513c6

Browse files
committedOct 30, 2014
Initial implementation of the proxy protocol for apache.
0 parents  commit 80513c6

8 files changed

+1263
-0
lines changed
 

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.libs
2+
mod_proxy_protocol.la
3+
mod_proxy_protocol.lo
4+
mod_proxy_protocol.slo

‎LICENSE

+202
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
2+
Apache License
3+
Version 2.0, January 2004
4+
http://www.apache.org/licenses/
5+
6+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
8+
1. Definitions.
9+
10+
"License" shall mean the terms and conditions for use, reproduction,
11+
and distribution as defined by Sections 1 through 9 of this document.
12+
13+
"Licensor" shall mean the copyright owner or entity authorized by
14+
the copyright owner that is granting the License.
15+
16+
"Legal Entity" shall mean the union of the acting entity and all
17+
other entities that control, are controlled by, or are under common
18+
control with that entity. For the purposes of this definition,
19+
"control" means (i) the power, direct or indirect, to cause the
20+
direction or management of such entity, whether by contract or
21+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
22+
outstanding shares, or (iii) beneficial ownership of such entity.
23+
24+
"You" (or "Your") shall mean an individual or Legal Entity
25+
exercising permissions granted by this License.
26+
27+
"Source" form shall mean the preferred form for making modifications,
28+
including but not limited to software source code, documentation
29+
source, and configuration files.
30+
31+
"Object" form shall mean any form resulting from mechanical
32+
transformation or translation of a Source form, including but
33+
not limited to compiled object code, generated documentation,
34+
and conversions to other media types.
35+
36+
"Work" shall mean the work of authorship, whether in Source or
37+
Object form, made available under the License, as indicated by a
38+
copyright notice that is included in or attached to the work
39+
(an example is provided in the Appendix below).
40+
41+
"Derivative Works" shall mean any work, whether in Source or Object
42+
form, that is based on (or derived from) the Work and for which the
43+
editorial revisions, annotations, elaborations, or other modifications
44+
represent, as a whole, an original work of authorship. For the purposes
45+
of this License, Derivative Works shall not include works that remain
46+
separable from, or merely link (or bind by name) to the interfaces of,
47+
the Work and Derivative Works thereof.
48+
49+
"Contribution" shall mean any work of authorship, including
50+
the original version of the Work and any modifications or additions
51+
to that Work or Derivative Works thereof, that is intentionally
52+
submitted to Licensor for inclusion in the Work by the copyright owner
53+
or by an individual or Legal Entity authorized to submit on behalf of
54+
the copyright owner. For the purposes of this definition, "submitted"
55+
means any form of electronic, verbal, or written communication sent
56+
to the Licensor or its representatives, including but not limited to
57+
communication on electronic mailing lists, source code control systems,
58+
and issue tracking systems that are managed by, or on behalf of, the
59+
Licensor for the purpose of discussing and improving the Work, but
60+
excluding communication that is conspicuously marked or otherwise
61+
designated in writing by the copyright owner as "Not a Contribution."
62+
63+
"Contributor" shall mean Licensor and any individual or Legal Entity
64+
on behalf of whom a Contribution has been received by Licensor and
65+
subsequently incorporated within the Work.
66+
67+
2. Grant of Copyright License. Subject to the terms and conditions of
68+
this License, each Contributor hereby grants to You a perpetual,
69+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70+
copyright license to reproduce, prepare Derivative Works of,
71+
publicly display, publicly perform, sublicense, and distribute the
72+
Work and such Derivative Works in Source or Object form.
73+
74+
3. Grant of Patent License. Subject to the terms and conditions of
75+
this License, each Contributor hereby grants to You a perpetual,
76+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77+
(except as stated in this section) patent license to make, have made,
78+
use, offer to sell, sell, import, and otherwise transfer the Work,
79+
where such license applies only to those patent claims licensable
80+
by such Contributor that are necessarily infringed by their
81+
Contribution(s) alone or by combination of their Contribution(s)
82+
with the Work to which such Contribution(s) was submitted. If You
83+
institute patent litigation against any entity (including a
84+
cross-claim or counterclaim in a lawsuit) alleging that the Work
85+
or a Contribution incorporated within the Work constitutes direct
86+
or contributory patent infringement, then any patent licenses
87+
granted to You under this License for that Work shall terminate
88+
as of the date such litigation is filed.
89+
90+
4. Redistribution. You may reproduce and distribute copies of the
91+
Work or Derivative Works thereof in any medium, with or without
92+
modifications, and in Source or Object form, provided that You
93+
meet the following conditions:
94+
95+
(a) You must give any other recipients of the Work or
96+
Derivative Works a copy of this License; and
97+
98+
(b) You must cause any modified files to carry prominent notices
99+
stating that You changed the files; and
100+
101+
(c) You must retain, in the Source form of any Derivative Works
102+
that You distribute, all copyright, patent, trademark, and
103+
attribution notices from the Source form of the Work,
104+
excluding those notices that do not pertain to any part of
105+
the Derivative Works; and
106+
107+
(d) If the Work includes a "NOTICE" text file as part of its
108+
distribution, then any Derivative Works that You distribute must
109+
include a readable copy of the attribution notices contained
110+
within such NOTICE file, excluding those notices that do not
111+
pertain to any part of the Derivative Works, in at least one
112+
of the following places: within a NOTICE text file distributed
113+
as part of the Derivative Works; within the Source form or
114+
documentation, if provided along with the Derivative Works; or,
115+
within a display generated by the Derivative Works, if and
116+
wherever such third-party notices normally appear. The contents
117+
of the NOTICE file are for informational purposes only and
118+
do not modify the License. You may add Your own attribution
119+
notices within Derivative Works that You distribute, alongside
120+
or as an addendum to the NOTICE text from the Work, provided
121+
that such additional attribution notices cannot be construed
122+
as modifying the License.
123+
124+
You may add Your own copyright statement to Your modifications and
125+
may provide additional or different license terms and conditions
126+
for use, reproduction, or distribution of Your modifications, or
127+
for any such Derivative Works as a whole, provided Your use,
128+
reproduction, and distribution of the Work otherwise complies with
129+
the conditions stated in this License.
130+
131+
5. Submission of Contributions. Unless You explicitly state otherwise,
132+
any Contribution intentionally submitted for inclusion in the Work
133+
by You to the Licensor shall be under the terms and conditions of
134+
this License, without any additional terms or conditions.
135+
Notwithstanding the above, nothing herein shall supersede or modify
136+
the terms of any separate license agreement you may have executed
137+
with Licensor regarding such Contributions.
138+
139+
6. Trademarks. This License does not grant permission to use the trade
140+
names, trademarks, service marks, or product names of the Licensor,
141+
except as required for reasonable and customary use in describing the
142+
origin of the Work and reproducing the content of the NOTICE file.
143+
144+
7. Disclaimer of Warranty. Unless required by applicable law or
145+
agreed to in writing, Licensor provides the Work (and each
146+
Contributor provides its Contributions) on an "AS IS" BASIS,
147+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148+
implied, including, without limitation, any warranties or conditions
149+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150+
PARTICULAR PURPOSE. You are solely responsible for determining the
151+
appropriateness of using or redistributing the Work and assume any
152+
risks associated with Your exercise of permissions under this License.
153+
154+
8. Limitation of Liability. In no event and under no legal theory,
155+
whether in tort (including negligence), contract, or otherwise,
156+
unless required by applicable law (such as deliberate and grossly
157+
negligent acts) or agreed to in writing, shall any Contributor be
158+
liable to You for damages, including any direct, indirect, special,
159+
incidental, or consequential damages of any character arising as a
160+
result of this License or out of the use or inability to use the
161+
Work (including but not limited to damages for loss of goodwill,
162+
work stoppage, computer failure or malfunction, or any and all
163+
other commercial damages or losses), even if such Contributor
164+
has been advised of the possibility of such damages.
165+
166+
9. Accepting Warranty or Additional Liability. While redistributing
167+
the Work or Derivative Works thereof, You may choose to offer,
168+
and charge a fee for, acceptance of support, warranty, indemnity,
169+
or other liability obligations and/or rights consistent with this
170+
License. However, in accepting such obligations, You may act only
171+
on Your own behalf and on Your sole responsibility, not on behalf
172+
of any other Contributor, and only if You agree to indemnify,
173+
defend, and hold each Contributor harmless for any liability
174+
incurred by, or claims asserted against, such Contributor by reason
175+
of your accepting any such warranty or additional liability.
176+
177+
END OF TERMS AND CONDITIONS
178+
179+
APPENDIX: How to apply the Apache License to your work.
180+
181+
To apply the Apache License to your work, attach the following
182+
boilerplate notice, with the fields enclosed by brackets "[]"
183+
replaced with your own identifying information. (Don't include
184+
the brackets!) The text should be enclosed in the appropriate
185+
comment syntax for the file format. We also recommend that a
186+
file or class name and description of purpose be included on the
187+
same "printed page" as the copyright notice for easier
188+
identification within third-party archives.
189+
190+
Copyright [yyyy] [name of copyright owner]
191+
192+
Licensed under the Apache License, Version 2.0 (the "License");
193+
you may not use this file except in compliance with the License.
194+
You may obtain a copy of the License at
195+
196+
http://www.apache.org/licenses/LICENSE-2.0
197+
198+
Unless required by applicable law or agreed to in writing, software
199+
distributed under the License is distributed on an "AS IS" BASIS,
200+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201+
See the License for the specific language governing permissions and
202+
limitations under the License.

‎Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
##
2+
## Makefile -- Build procedure for sample proxy_protocol Apache module
3+
## Autogenerated via ``apxs -n proxy_protocol -g''.
4+
##
5+
6+
# the used tools
7+
APXS=apxs
8+
9+
# the default target
10+
all: .libs/mod_proxy_protocol.so
11+
12+
# build the so in the current directory
13+
.libs/mod_proxy_protocol.so: mod_proxy_protocol.c
14+
$(APXS) -c mod_proxy_protocol.c
15+
16+
# install the so - usually needs root access
17+
install: .libs/mod_proxy_protocol.so
18+
$(APXS) -i mod_proxy_protocol.c
19+
20+
# cleanup
21+
clean:
22+
-rm -rf mod_proxy_protocol.o mod_proxy_protocol.lo mod_proxy_protocol.slo mod_proxy_protocol.la .libs

‎README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Apache Proxy Protocol Module
2+
3+
This is an [Apache](http://httpd.apache.org/) module that implements the
4+
server side of HAProxy's
5+
[Proxy Protocol](http://blog.haproxy.com/haproxy/proxy-protocol/).
6+
7+
## Build and Install
8+
9+
You'll need the apache development packages installed (typically something
10+
like `apache-devel` or `apache2-dev`). Then simply running `make` will
11+
create the shared library in `.libs/mod_proxy_protocol.so`; `make install`
12+
will attempt to install it in your current apache installation (you'll
13+
probably need to be root for this).
14+
15+
## Configuration
16+
17+
Add the following directive to your apache config to load the module
18+
19+
LoadModule proxy_protocol_module mod_proxy_protocol.so
20+
21+
or try running
22+
23+
apxs -a mod_proxy_protocol.c
24+
25+
For configuration details see the
26+
[module docs](mod_proxy_protocol.html)
27+
28+
## Amazon EC2 Notes
29+
30+
To properly secure Apache when using this on EC2 behind an ELB you'll probably
31+
want to do something like the following to ensure that only the ELB can
32+
provide the proxy protocol header while still being able to access the site
33+
directly (not via the ELB):
34+
35+
1. In Apache create a copy of virtual host with a new port, and add the
36+
'ProxyProtocol On' for this new virtual host.
37+
2. Add an entry to the security group for the server that only allows access
38+
to this new port from the ELB.
39+
3. Point the ELB at this new port (and enable the proxy protocol for that)
40+
41+
## TODO
42+
43+
* Add access-control (see commented out `ProxyProtocolTrustedProxies` in
44+
`mod_proxy_protocol.xml`)
45+
* Add support for outgoing connections (`mod_proxy`)
46+

‎mod_proxy_protocol.c

+736
Large diffs are not rendered by default.

‎mod_proxy_protocol.html

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><!--
3+
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4+
This file is generated from xml source: DO NOT EDIT
5+
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
6+
-->
7+
<title>mod_proxy_protocol - Apache HTTP Server Version 2.4</title>
8+
<link title="Main stylesheet" type="text/css" media="all" rel="stylesheet" href="https://httpd.apache.org/docs/2.4/style/css/manual.css"/>
9+
<link title="No Sidebar - Default font size" type="text/css" media="all" rel="alternate stylesheet" href="https://httpd.apache.org/docs/2.4/style/css/manual-loose-100pc.css"/>
10+
<link type="text/css" media="print" rel="stylesheet" href="https://httpd.apache.org/docs/2.4/style/css/manual-print.css"/><link href="https://httpd.apache.org/docs/2.4/style/css/prettify.css" type="text/css" rel="stylesheet"/>
11+
<script type="text/javascript" src="https://httpd.apache.org/docs/2.4/style/scripts/prettify.min.js">
12+
</script>
13+
14+
<link rel="shortcut icon" href="https://httpd.apache.org/docs/2.4/images/favicon.ico"/></head>
15+
<body>
16+
<div id="page-header">
17+
<p class="menu"><a href="https://httpd.apache.org/docs/2.4/mod/">Modules</a> | <a href="https://httpd.apache.org/docs/2.4/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="https://httpd.apache.org/docs/2.4/glossary.html">Glossary</a> | <a href="https://httpd.apache.org/docs/2.4/sitemap.html">Sitemap</a></p>
18+
<p class="apache">Apache HTTP Server Version 2.4</p>
19+
<img src="https://httpd.apache.org/docs/2.4/images/feather.gif" alt=""/></div>
20+
<div class="up"><a href="./"><img src="https://httpd.apache.org/docs/2.4/images/left.gif" alt="&lt;-" title="&lt;-"/></a></div>
21+
<div id="path">
22+
<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="https://httpd.apache.org/docs/2.4/">Version 2.4</a> &gt; <a href="./">Modules</a></div>
23+
<div id="page-content">
24+
<div id="preamble"><h1>Apache Module mod_proxy_protocol</h1>
25+
<div class="toplang">
26+
<p><span>Available Languages: </span></p>
27+
</div>
28+
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Implements the server side of the proxy protocol.</td></tr>
29+
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30+
<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_protocol_module</td></tr>
31+
<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_proxy_protocol.c</td></tr></table>
32+
<h3>Summary</h3>
33+
34+
<p><code class="module"><a href="https://httpd.apache.org/docs/2.4/mod/mod_proxy_protocol.html">mod_proxy_protocol</a></code> implements the server side of
35+
HAProxy's
36+
<a href="http://blog.haproxy.com/haproxy/proxy-protocol/">Proxy Protocol</a>.</p>
37+
38+
<p>The module overrides the client IP address for the connection
39+
with the information supplied by the upstream proxy in the proxy
40+
protocol (connection) header.</p>
41+
42+
<p>This overridden useragent IP address is then used for the
43+
<code class="module"><a href="https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html">mod_authz_host</a></code>
44+
<code class="directive"><a href="https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require">Require ip</a></code>
45+
feature, is reported by <code class="module"><a href="https://httpd.apache.org/docs/2.4/mod/mod_status.html">mod_status</a></code>, and is recorded by
46+
<code class="module"><a href="https://httpd.apache.org/docs/2.4/mod/mod_log_config.html">mod_log_config</a></code> <code>%a</code> and <code class="module"><a href="https://httpd.apache.org/docs/2.4/mod/core.html">core</a></code>
47+
<code>%a</code> format strings. The underlying client IP of the connection
48+
is available in the <code>%{c}a</code> format string.</p>
49+
50+
<div class="warning">It is critical to only enable this behavior from
51+
intermediate proxies which are trusted by this server, since it is trivial
52+
for the remote client to impersonate another client. Currently this must
53+
be done by external means (such as a firewall) as this module does not
54+
(yet) implement access controls.</div>
55+
</div>
56+
<div id="quickview"><h3 class="directives">Directives</h3>
57+
<ul id="toc">
58+
<li><img src="https://httpd.apache.org/docs/2.4/images/down.gif" alt=""/> <a href="#proxyprotocol">ProxyProtocol</a></li>
59+
</ul>
60+
<h3>See also</h3>
61+
<ul class="seealso">
62+
<li><a href="http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt">Proxy Protocol Spec</a></li>
63+
</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
64+
65+
<div class="top"><a href="#page-header"><img src="https://httpd.apache.org/docs/2.4/images/up.gif" alt="top"/></a></div>
66+
<div class="directive-section"><h2><a id="ProxyProtocol" name="ProxyProtocol">ProxyProtocol</a> <a id="proxyprotocol" name="proxyprotocol">Directive</a></h2>
67+
<table class="directive">
68+
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable or disable the proxy protocol handling</td></tr>
69+
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyProtocol On|Off</code></td></tr>
70+
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
71+
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
72+
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_protocol</td></tr>
73+
</table>
74+
<p>The <code class="directive">ProxyProtocol</code> enables or disables the
75+
reading and handling of the proxy protocol connection header. If enabled
76+
the upstream client <em>must</em> send the header every time it opens a
77+
connection or the connection will get aborted.</p>
78+
79+
<p>While this directive may be specified in any virtual host, it is
80+
important to understand that because the proxy protocol is connection
81+
based and protocol agnostic, the enabling and disabling is actually based
82+
on ip-address and port. This means that if you have multiple name-based
83+
virtual hosts for the same host and port, and you enable it any one of
84+
them, then it is enabled for all them (with that host and port). It also
85+
means that if you attempt to enable the proxy protocol in one and disable
86+
in the other, that won't work; in such a case the last one wins and a
87+
notice will be logged indicating which setting was being overridden.</p>
88+
89+
<pre class="prettyprint lang-config">ProxyProtocol On</pre>
90+
91+
92+
</div>
93+
</div>
94+
<div class="bottomlang">
95+
<p><span>Available Languages: </span></p>
96+
</div><div class="top"><a href="#page-header"><img alt="top" src="https://httpd.apache.org/docs/2.4/images/up.gif"/></a></div><div class="section"><h2><a name="comments_section" id="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br/>This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
97+
<script type="text/javascript"><!--//--><![CDATA[//><!--
98+
var comments_shortname = 'httpd';
99+
var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_proxy_protocol.html';
100+
(function(w, d) {
101+
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
102+
d.write('<div id="comments_thread"><\/div>');
103+
var s = d.createElement('script');
104+
s.type = 'text/javascript';
105+
s.async = true;
106+
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
107+
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
108+
}
109+
else {
110+
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
111+
}
112+
})(window, document);
113+
//--><!]]></script></div><div id="footer">
114+
<p class="apache">Copyright 2014 The Apache Software Foundation.<br/>Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
115+
<p class="menu"><a href="https://httpd.apache.org/docs/2.4/mod/">Modules</a> | <a href="https://httpd.apache.org/docs/2.4/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="https://httpd.apache.org/docs/2.4/glossary.html">Glossary</a> | <a href="https://httpd.apache.org/docs/2.4/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
116+
if (typeof(prettyPrint) !== 'undefined') {
117+
prettyPrint();
118+
}
119+
//--><!]]></script>
120+
</body></html>

‎mod_proxy_protocol.xml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE modulesynopsis SYSTEM "https://httpd.apache.org/docs/2.4/style/modulesynopsis.dtd">
3+
<?xml-stylesheet type="text/xsl" href="https://httpd.apache.org/docs/2.4/style/manual.en.xsl"?>
4+
5+
<!--
6+
Copyright 2014 Cloudzilla Inc.
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
-->
20+
21+
<modulesynopsis metafile="mod_proxy_protocol.xml.meta">
22+
23+
<name>mod_proxy_protocol</name>
24+
<description>Implements the server side of the proxy protocol.</description>
25+
<status>Extension</status>
26+
<sourcefile>mod_proxy_protocol.c</sourcefile>
27+
<identifier>proxy_protocol_module</identifier>
28+
29+
<summary>
30+
<p><module>mod_proxy_protocol</module> implements the server side of
31+
HAProxy's
32+
<a href="http://blog.haproxy.com/haproxy/proxy-protocol/">Proxy Protocol</a>.</p>
33+
34+
<p>The module overrides the client IP address for the connection
35+
with the information supplied by the upstream proxy in the proxy
36+
protocol (connection) header.</p>
37+
38+
<p>This overridden useragent IP address is then used for the
39+
<module>mod_authz_host</module>
40+
<directive module="mod_authz_core" name="require">Require ip</directive>
41+
feature, is reported by <module>mod_status</module>, and is recorded by
42+
<module>mod_log_config</module> <code>%a</code> and <module>core</module>
43+
<code>%a</code> format strings. The underlying client IP of the connection
44+
is available in the <code>%{c}a</code> format string.</p>
45+
46+
<note type="warning">It is critical to only enable this behavior from
47+
intermediate proxies which are trusted by this server, since it is trivial
48+
for the remote client to impersonate another client. Currently this must
49+
be done by external means (such as a firewall) as this module does not
50+
(yet) implement access controls.</note>
51+
</summary>
52+
<seealso><a href="http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt">Proxy Protocol Spec</a></seealso>
53+
54+
<directivesynopsis>
55+
<name>ProxyProtocol</name>
56+
<description>Enable or disable the proxy protocol handling</description>
57+
<syntax>ProxyProtocol On|Off</syntax>
58+
<contextlist><context>server config</context><context>virtual host</context>
59+
</contextlist>
60+
61+
<usage>
62+
<p>The <directive>ProxyProtocol</directive> enables or disables the
63+
reading and handling of the proxy protocol connection header. If enabled
64+
the upstream client <em>must</em> send the header every time it opens a
65+
connection or the connection will get aborted.</p>
66+
67+
<p>While this directive may be specified in any virtual host, it is
68+
important to understand that because the proxy protocol is connection
69+
based and protocol agnostic, the enabling and disabling is actually based
70+
on ip-address and port. This means that if you have multiple name-based
71+
virtual hosts for the same host and port, and you enable it any one of
72+
them, then it is enabled for all them (with that host and port). It also
73+
means that if you attempt to enable the proxy protocol in one and disable
74+
in the other, that won't work; in such a case the last one wins and a
75+
notice will be logged indicating which setting was being overridden.</p>
76+
77+
<highlight language="config">
78+
ProxyProtocol On
79+
</highlight>
80+
</usage>
81+
</directivesynopsis>
82+
83+
<!--
84+
<directivesynopsis>
85+
<name>ProxyProtocolTrustedProxies</name>
86+
<description>A listed of clients that are trusted to provide the proxy
87+
protocol header.</description>
88+
<syntax>ProxyProtocolTrustedProxies <var>levels</var></syntax>
89+
<syntax>ProxyProtocolTrustedProxies all|<var>host</var> [<var>host</var>] ...</syntax>
90+
<default>ProxyProtocolTrustedProxies all</default>
91+
<contextlist><context>server config</context><context>virtual host</context>
92+
</contextlist>
93+
94+
<usage>
95+
<p>The <directive>ProxyProtocolTrustedProxies</directive> directive limits
96+
which clients are trusted to use the proxy protocol. What happens when a
97+
client is not trusted is controlled by the
98+
<directive module="mod_proxy_protocol">ProxyProtocolRejectUntrusted</directive>
99+
directive.</p>
100+
</usage>
101+
</directivesynopsis>
102+
103+
<directivesynopsis>
104+
<name>ProxyProtocolRejectUntrusted</name>
105+
<description>The number of characters in subdirectory names</description>
106+
<syntax>ProxyProtocolRejectUntrusted On|Off</syntax>
107+
<default>ProxyProtocolRejectUntrusted On</default>
108+
<contextlist><context>server config</context><context>virtual host</context>
109+
</contextlist>
110+
111+
<usage>
112+
<p>The <directive>ProxyProtocolRejectUntrusted</directive> directive
113+
controls the behavior when a connection is received from an untrusted
114+
client (as configured by the
115+
<directive module="mod_proxy_protocol">ProxyProtocolTrustedProxies</directive>
116+
directive) on a host and port for which the proxy protocol has been enabled.
117+
If set to On (the default) then the connection is aborted; if set to Off
118+
then the connection is allowed, and client must send a valid proxy protocol
119+
header, but the contents of the header are ignored and the client IP for
120+
the connection left untouched (i.e. will be that of the immediate client).
121+
</p>
122+
</usage>
123+
</directivesynopsis>
124+
-->
125+
126+
</modulesynopsis>

‎mod_proxy_protocol.xml.meta

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<metafile reference="mod_proxy_protocol.xml">
4+
<basename>mod_proxy_protocol</basename>
5+
<path>/mod/</path>
6+
<relpath>https://httpd.apache.org/docs/2.4</relpath>
7+
</metafile>

0 commit comments

Comments
 (0)
Please sign in to comment.