Merge ~hloeung/content-cache-charm:log into content-cache-charm:master
- Git
- lp:~hloeung/content-cache-charm
- log
- Merge into master
Proposed by
Haw Loeung
Status: | Merged |
---|---|
Approved by: | Haw Loeung |
Approved revision: | 9e2a6125b64b7d258563503e8a56d1bc10ba7d73 |
Merged at revision: | ecc5578a0c9e979e1f3e877c3987a2c7627d41bf |
Proposed branch: | ~hloeung/content-cache-charm:log |
Merge into: | content-cache-charm:master |
Diff against target: |
1056 lines (+121/-121) 17 files modified
files/nginx-logging-format.conf (+1/-1) lib/haproxy.py (+2/-2) reactive/content_cache.py (+1/-1) tests/unit/files/config_test_config.txt (+1/-1) tests/unit/files/config_test_sites_map.txt (+1/-1) tests/unit/files/content_cache_rendered_haproxy_test_output.txt (+20/-20) tests/unit/files/content_cache_rendered_haproxy_test_output2.txt (+2/-2) tests/unit/files/content_cache_rendered_haproxy_test_output3.txt (+2/-2) tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt (+20/-20) tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt (+3/-3) tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt (+20/-20) tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt (+20/-20) tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads_haproxy2.txt (+20/-20) tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt (+2/-2) tests/unit/files/haproxy_config_rendered_backends_stanzas_test_output.txt (+2/-2) tests/unit/files/haproxy_config_rendered_test_output.txt (+2/-2) tests/unit/files/haproxy_config_rendered_test_output2.txt (+2/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Misare | Approve | ||
Canonical IS Reviewers | Pending | ||
Canonical IS Reviewers | Pending | ||
Review via email: mp+397698@code.launchpad.net |
This proposal supersedes a proposal from 2021-02-08.
Commit message
Introduce new header X-Cache-Request-IP and log that
This prevents spoofing of X-Forward-For or any additional hops from
being logged.
Description of the change
To post a comment you must log in.
Revision history for this message
Haw Loeung (hloeung) wrote : Posted in a previous version of this proposal | # |
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : Posted in a previous version of this proposal | # |
This merge proposal is being monitored by mergebot. Change the status to Approved to merge.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : | # |
This merge proposal is being monitored by mergebot. Change the status to Approved to merge.
Revision history for this message
Colin Misare (cmisare) wrote : | # |
One question inline
Revision history for this message
Haw Loeung (hloeung) : | # |
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : | # |
Change successfully merged at revision ecc5578a0c9e979
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/files/nginx-logging-format.conf b/files/nginx-logging-format.conf |
2 | index a646743..b9df464 100644 |
3 | --- a/files/nginx-logging-format.conf |
4 | +++ b/files/nginx-logging-format.conf |
5 | @@ -1,4 +1,4 @@ |
6 | -log_format content_cache '$http_x_forwarded_for - $remote_user [$time_local] ' |
7 | +log_format content_cache '$http_x_cache_request_ip - $remote_user [$time_local] ' |
8 | '"$request" $status $bytes_sent ' |
9 | '"$http_referer" "$http_user_agent" $request_time ' |
10 | '$upstream_cache_status $upstream_response_time ' |
11 | diff --git a/lib/haproxy.py b/lib/haproxy.py |
12 | index 2bf795e..597131e 100644 |
13 | --- a/lib/haproxy.py |
14 | +++ b/lib/haproxy.py |
15 | @@ -222,8 +222,8 @@ listen {name} |
16 | def render_stanza_backend(self, config): # NOQA: C901 |
17 | backend_stanza = """ |
18 | backend backend-{name} |
19 | -{options}{indent}{httpchk} |
20 | -{indent}http-request set-header Host {site_name} |
21 | +{indent}{httpchk} |
22 | +{options}{indent}http-request set-header Host {site_name} |
23 | {indent}balance {load_balancing_algorithm} |
24 | {backends} |
25 | """ |
26 | diff --git a/reactive/content_cache.py b/reactive/content_cache.py |
27 | index ec681d6..9f95727 100644 |
28 | --- a/reactive/content_cache.py |
29 | +++ b/reactive/content_cache.py |
30 | @@ -281,7 +281,7 @@ def configure_haproxy(): # NOQA: C901 LP#1825084 |
31 | # Also, for caching layer, we want higher fall count as it's less |
32 | # likely the caching layer is down, 2 mins here (inter * fall). |
33 | new_cached_loc_conf['backend-fall-count'] = 60 |
34 | - new_cached_loc_conf['backend-options'] = ['forwardfor'] |
35 | + new_cached_loc_conf['backend-options'] = ['http-request set-header X-Cache-Request-IP %[src]'] |
36 | |
37 | # No backends |
38 | if not site_conf['locations'][location].get('backends'): |
39 | diff --git a/tests/unit/files/config_test_config.txt b/tests/unit/files/config_test_config.txt |
40 | index bae4473..688b8af 100644 |
41 | --- a/tests/unit/files/config_test_config.txt |
42 | +++ b/tests/unit/files/config_test_config.txt |
43 | @@ -46,7 +46,7 @@ site3.local: |
44 | /: |
45 | backends: *BACKENDS |
46 | backend-options: |
47 | - - forwardfor except 127.0.0.1 |
48 | + - forwardfor except 127.0.0.1 192.168.1.1 |
49 | - forceclose |
50 | cache-maxconn: 4096 |
51 | |
52 | diff --git a/tests/unit/files/config_test_sites_map.txt b/tests/unit/files/config_test_sites_map.txt |
53 | index 7158e24..6f130c7 100644 |
54 | --- a/tests/unit/files/config_test_sites_map.txt |
55 | +++ b/tests/unit/files/config_test_sites_map.txt |
56 | @@ -39,7 +39,7 @@ site3.local: |
57 | locations: |
58 | /: |
59 | backend-options: |
60 | - - forwardfor except 127.0.0.1 |
61 | + - forwardfor except 127.0.0.1 192.168.1.1 |
62 | - forceclose |
63 | backend_port: 8082 |
64 | backends: |
65 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output.txt |
66 | index 9f6292d..2e20fd6 100644 |
67 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output.txt |
68 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output.txt |
69 | @@ -155,15 +155,15 @@ listen site9-local |
70 | default_backend backend-site9-local |
71 | |
72 | backend backend-cached-site1-local |
73 | - option forwardfor |
74 | option httpchk HEAD /?token=1861920000_f3e404e205ed44749e942d481f7a7bec57c5e78a HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
75 | + http-request set-header X-Cache-Request-IP %[src] |
76 | http-request set-header Host site1.local |
77 | balance leastconn |
78 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 600 |
79 | |
80 | backend backend-site1-local |
81 | - option redispatch 1 |
82 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
83 | + option redispatch 1 |
84 | http-request set-header Host site1.local |
85 | balance leastconn |
86 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
87 | @@ -171,15 +171,15 @@ backend backend-site1-local |
88 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
89 | |
90 | backend backend-cached-site2-local |
91 | - option forwardfor |
92 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
93 | + http-request set-header X-Cache-Request-IP %[src] |
94 | http-request set-header Host site2.local |
95 | balance leastconn |
96 | server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 3072 |
97 | |
98 | backend backend-site2-local |
99 | - option redispatch 1 |
100 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
101 | + option redispatch 1 |
102 | http-request set-header Host site2.local |
103 | balance leastconn |
104 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
105 | @@ -187,17 +187,17 @@ backend backend-site2-local |
106 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
107 | |
108 | backend backend-cached-site3-local |
109 | - option forwardfor |
110 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
111 | + http-request set-header X-Cache-Request-IP %[src] |
112 | http-request set-header Host site3.local |
113 | balance leastconn |
114 | server server_1 127.0.0.1:6082 check inter 2s rise 2 fall 60 maxconn 4096 |
115 | |
116 | backend backend-site3-local |
117 | - option forwardfor except 127.0.0.1 |
118 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
119 | + option forwardfor except 127.0.0.1 192.168.1.1 |
120 | option forceclose |
121 | option redispatch 1 |
122 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
123 | http-request set-header Host site3.local |
124 | balance leastconn |
125 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
126 | @@ -205,92 +205,92 @@ backend backend-site3-local |
127 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
128 | |
129 | backend backend-cached-site4-local |
130 | - option forwardfor |
131 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site4.local\r\nUser-Agent:\ haproxy/httpchk |
132 | + http-request set-header X-Cache-Request-IP %[src] |
133 | http-request set-header Host site4.local |
134 | balance leastconn |
135 | server server_1 127.0.0.1:6083 check inter 2s rise 2 fall 60 maxconn 200 |
136 | |
137 | backend backend-cached-site5 |
138 | - option forwardfor |
139 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
140 | + http-request set-header X-Cache-Request-IP %[src] |
141 | http-request set-header Host site5.local |
142 | balance leastconn |
143 | server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 200 |
144 | |
145 | backend backend-site5 |
146 | - option redispatch 1 |
147 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
148 | + option redispatch 1 |
149 | http-request set-header Host site5.local |
150 | balance leastconn |
151 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
152 | |
153 | backend backend-site5-2 |
154 | - option redispatch 1 |
155 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
156 | + option redispatch 1 |
157 | http-request set-header Host site5.local |
158 | balance leastconn |
159 | server server_1 127.0.1.11:80 check inter 5s rise 2 fall 5 maxconn 200 |
160 | |
161 | backend backend-cached-site6-local |
162 | - option forwardfor |
163 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
164 | + http-request set-header X-Cache-Request-IP %[src] |
165 | http-request set-header Host site6.local |
166 | balance leastconn |
167 | server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 200 |
168 | |
169 | backend backend-site6-local |
170 | - option redispatch 1 |
171 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
172 | + option redispatch 1 |
173 | http-request set-header Host site6.local |
174 | balance leastconn |
175 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(site6.local) check-sni site6.local verify required ca-file ca-certificates.crt |
176 | |
177 | backend backend-cached-site7-local |
178 | - option forwardfor |
179 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
180 | + http-request set-header X-Cache-Request-IP %[src] |
181 | http-request set-header Host site7.local |
182 | balance leastconn |
183 | server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 200 |
184 | |
185 | backend backend-site7-local |
186 | - option redispatch 1 |
187 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
188 | + option redispatch 1 |
189 | http-request set-header Host site7.local |
190 | balance leastconn |
191 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
192 | |
193 | backend backend-cached-site8-local |
194 | - option forwardfor |
195 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
196 | + http-request set-header X-Cache-Request-IP %[src] |
197 | http-request set-header Host site8.local |
198 | balance leastconn |
199 | server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 200 |
200 | |
201 | backend backend-site8-local |
202 | - option redispatch 1 |
203 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
204 | + option redispatch 1 |
205 | http-request set-header Host site8.local |
206 | balance leastconn |
207 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
208 | |
209 | backend backend-site8-local-2 |
210 | - option redispatch 1 |
211 | option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk |
212 | + option redispatch 1 |
213 | http-request set-header Host auth.site8.local |
214 | balance leastconn |
215 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(auth.site8.local) check-sni auth.site8.local verify required ca-file ca-certificates.crt |
216 | |
217 | backend backend-cached-site9-local |
218 | - option forwardfor |
219 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
220 | + http-request set-header X-Cache-Request-IP %[src] |
221 | http-request set-header Host site9.local |
222 | balance leastconn |
223 | server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 200 |
224 | |
225 | backend backend-site9-local |
226 | - option redispatch 1 |
227 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
228 | + option redispatch 1 |
229 | http-request set-header Host site9.local |
230 | balance leastconn |
231 | server server_1 127.0.1.15:80 check inter 1m rise 2 fall 5 maxconn 200 |
232 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt |
233 | index 22ddfcd..5f6824b 100644 |
234 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt |
235 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt |
236 | @@ -90,16 +90,16 @@ listen site1-local |
237 | default_backend backend-site1-local |
238 | |
239 | backend backend-cached-site1-local |
240 | - option forwardfor |
241 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
242 | + http-request set-header X-Cache-Request-IP %[src] |
243 | http-request set-header Host site1.local |
244 | balance leastconn |
245 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 200 |
246 | |
247 | backend backend-site1-local |
248 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
249 | retries 3 |
250 | option redispatch 1 |
251 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
252 | http-request set-header Host site1.local |
253 | balance leastconn |
254 | server server_1 192.168.1.1:8080 check inter 5s rise 2 fall 5 maxconn 200 |
255 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt |
256 | index dd8a6f7..83641cc 100644 |
257 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt |
258 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt |
259 | @@ -96,15 +96,15 @@ listen site1-local |
260 | default_backend backend-site1-local |
261 | |
262 | backend backend-cached-site1-local |
263 | - option forwardfor |
264 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
265 | + http-request set-header X-Cache-Request-IP %[src] |
266 | http-request set-header Host site1.local |
267 | balance leastconn |
268 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 200 |
269 | |
270 | backend backend-site1-local |
271 | - option redispatch 1 |
272 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
273 | + option redispatch 1 |
274 | http-request set-header Host site1.local |
275 | balance leastconn |
276 | server server_1 192.168.1.1:8080 check inter 5s rise 2 fall 5 maxconn 200 |
277 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt |
278 | index 8de817a..e417ae8 100644 |
279 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt |
280 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt |
281 | @@ -155,15 +155,15 @@ listen site9-local |
282 | default_backend backend-site9-local |
283 | |
284 | backend backend-cached-site1-local |
285 | - option forwardfor |
286 | option httpchk HEAD /?token=1861920000_f3e404e205ed44749e942d481f7a7bec57c5e78a HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
287 | + http-request set-header X-Cache-Request-IP %[src] |
288 | http-request set-header Host site1.local |
289 | balance leastconn |
290 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 600 |
291 | |
292 | backend backend-site1-local |
293 | - option redispatch 1 |
294 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
295 | + option redispatch 1 |
296 | http-request set-header Host site1.local |
297 | balance leastconn |
298 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
299 | @@ -171,15 +171,15 @@ backend backend-site1-local |
300 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
301 | |
302 | backend backend-cached-site2-local |
303 | - option forwardfor |
304 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
305 | + http-request set-header X-Cache-Request-IP %[src] |
306 | http-request set-header Host site2.local |
307 | balance leastconn |
308 | server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 3072 |
309 | |
310 | backend backend-site2-local |
311 | - option redispatch 1 |
312 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
313 | + option redispatch 1 |
314 | http-request set-header Host site2.local |
315 | balance leastconn |
316 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
317 | @@ -187,17 +187,17 @@ backend backend-site2-local |
318 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
319 | |
320 | backend backend-cached-site3-local |
321 | - option forwardfor |
322 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
323 | + http-request set-header X-Cache-Request-IP %[src] |
324 | http-request set-header Host site3.local |
325 | balance leastconn |
326 | server server_1 127.0.0.1:6082 check inter 2s rise 2 fall 60 maxconn 4096 |
327 | |
328 | backend backend-site3-local |
329 | - option forwardfor except 127.0.0.1 |
330 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
331 | + option forwardfor except 127.0.0.1 192.168.1.1 |
332 | option forceclose |
333 | option redispatch 1 |
334 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
335 | http-request set-header Host site3.local |
336 | balance leastconn |
337 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
338 | @@ -205,92 +205,92 @@ backend backend-site3-local |
339 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
340 | |
341 | backend backend-cached-site4-local |
342 | - option forwardfor |
343 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site4.local\r\nUser-Agent:\ haproxy/httpchk |
344 | + http-request set-header X-Cache-Request-IP %[src] |
345 | http-request set-header Host site4.local |
346 | balance leastconn |
347 | server server_1 127.0.0.1:6083 check inter 2s rise 2 fall 60 maxconn 200 |
348 | |
349 | backend backend-cached-site5 |
350 | - option forwardfor |
351 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
352 | + http-request set-header X-Cache-Request-IP %[src] |
353 | http-request set-header Host site5.local |
354 | balance leastconn |
355 | server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 200 |
356 | |
357 | backend backend-site5 |
358 | - option redispatch 1 |
359 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
360 | + option redispatch 1 |
361 | http-request set-header Host site5.local |
362 | balance leastconn |
363 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
364 | |
365 | backend backend-site5-2 |
366 | - option redispatch 1 |
367 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
368 | + option redispatch 1 |
369 | http-request set-header Host site5.local |
370 | balance leastconn |
371 | server server_1 127.0.1.11:80 check inter 5s rise 2 fall 5 maxconn 200 |
372 | |
373 | backend backend-cached-site6-local |
374 | - option forwardfor |
375 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
376 | + http-request set-header X-Cache-Request-IP %[src] |
377 | http-request set-header Host site6.local |
378 | balance leastconn |
379 | server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 200 |
380 | |
381 | backend backend-site6-local |
382 | - option redispatch 1 |
383 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
384 | + option redispatch 1 |
385 | http-request set-header Host site6.local |
386 | balance leastconn |
387 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(site6.local) check-sni site6.local verify required ca-file ca-certificates.crt |
388 | |
389 | backend backend-cached-site7-local |
390 | - option forwardfor |
391 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
392 | + http-request set-header X-Cache-Request-IP %[src] |
393 | http-request set-header Host site7.local |
394 | balance leastconn |
395 | server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 200 |
396 | |
397 | backend backend-site7-local |
398 | - option redispatch 1 |
399 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
400 | + option redispatch 1 |
401 | http-request set-header Host site7.local |
402 | balance leastconn |
403 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
404 | |
405 | backend backend-cached-site8-local |
406 | - option forwardfor |
407 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
408 | + http-request set-header X-Cache-Request-IP %[src] |
409 | http-request set-header Host site8.local |
410 | balance leastconn |
411 | server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 200 |
412 | |
413 | backend backend-site8-local |
414 | - option redispatch 1 |
415 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
416 | + option redispatch 1 |
417 | http-request set-header Host site8.local |
418 | balance leastconn |
419 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
420 | |
421 | backend backend-site8-local-2 |
422 | - option redispatch 1 |
423 | option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk |
424 | + option redispatch 1 |
425 | http-request set-header Host auth.site8.local |
426 | balance leastconn |
427 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(auth.site8.local) check-sni auth.site8.local verify required ca-file ca-certificates.crt |
428 | |
429 | backend backend-cached-site9-local |
430 | - option forwardfor |
431 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
432 | + http-request set-header X-Cache-Request-IP %[src] |
433 | http-request set-header Host site9.local |
434 | balance leastconn |
435 | server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 200 |
436 | |
437 | backend backend-site9-local |
438 | - option redispatch 1 |
439 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
440 | + option redispatch 1 |
441 | http-request set-header Host site9.local |
442 | balance leastconn |
443 | server server_1 127.0.1.15:80 check inter 1m rise 2 fall 5 maxconn 200 |
444 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt |
445 | index aaf84c5..3a80145 100644 |
446 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt |
447 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt |
448 | @@ -95,24 +95,24 @@ listen site1-local-2 |
449 | default_backend backend-site1-local-2 |
450 | |
451 | backend backend-cached-site1-local |
452 | - option forwardfor |
453 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
454 | + http-request set-header X-Cache-Request-IP %[src] |
455 | http-request set-header Host site1.local |
456 | balance leastconn |
457 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 400 |
458 | |
459 | backend backend-site1-local |
460 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
461 | option allbackups |
462 | option redispatch 1 |
463 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
464 | http-request set-header Host site1.local |
465 | balance leastconn |
466 | server server_1 192.168.1.1:8080 check inter 5s rise 2 fall 5 maxconn 200 |
467 | server server_2 192.168.1.2:8080 backup check inter 5s rise 2 fall 5 maxconn 200 |
468 | |
469 | backend backend-site1-local-2 |
470 | - option redispatch 1 |
471 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
472 | + option redispatch 1 |
473 | http-request set-header Host site1.local |
474 | balance leastconn |
475 | server server_1 192.168.1.1:8080 check inter 5s rise 2 fall 5 maxconn 200 |
476 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt |
477 | index 29451b9..0d34d81 100644 |
478 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt |
479 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt |
480 | @@ -155,15 +155,15 @@ listen site9-local |
481 | default_backend backend-site9-local |
482 | |
483 | backend backend-cached-site1-local |
484 | - option forwardfor |
485 | option httpchk HEAD /?token=1861920000_f3e404e205ed44749e942d481f7a7bec57c5e78a HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
486 | + http-request set-header X-Cache-Request-IP %[src] |
487 | http-request set-header Host site1.local |
488 | balance roundrobin |
489 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 600 |
490 | |
491 | backend backend-site1-local |
492 | - option redispatch 1 |
493 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
494 | + option redispatch 1 |
495 | http-request set-header Host site1.local |
496 | balance roundrobin |
497 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
498 | @@ -171,15 +171,15 @@ backend backend-site1-local |
499 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
500 | |
501 | backend backend-cached-site2-local |
502 | - option forwardfor |
503 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
504 | + http-request set-header X-Cache-Request-IP %[src] |
505 | http-request set-header Host site2.local |
506 | balance roundrobin |
507 | server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 3072 |
508 | |
509 | backend backend-site2-local |
510 | - option redispatch 1 |
511 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
512 | + option redispatch 1 |
513 | http-request set-header Host site2.local |
514 | balance roundrobin |
515 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
516 | @@ -187,17 +187,17 @@ backend backend-site2-local |
517 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
518 | |
519 | backend backend-cached-site3-local |
520 | - option forwardfor |
521 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
522 | + http-request set-header X-Cache-Request-IP %[src] |
523 | http-request set-header Host site3.local |
524 | balance roundrobin |
525 | server server_1 127.0.0.1:6082 check inter 2s rise 2 fall 60 maxconn 4096 |
526 | |
527 | backend backend-site3-local |
528 | - option forwardfor except 127.0.0.1 |
529 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
530 | + option forwardfor except 127.0.0.1 192.168.1.1 |
531 | option forceclose |
532 | option redispatch 1 |
533 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
534 | http-request set-header Host site3.local |
535 | balance roundrobin |
536 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
537 | @@ -205,92 +205,92 @@ backend backend-site3-local |
538 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
539 | |
540 | backend backend-cached-site4-local |
541 | - option forwardfor |
542 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site4.local\r\nUser-Agent:\ haproxy/httpchk |
543 | + http-request set-header X-Cache-Request-IP %[src] |
544 | http-request set-header Host site4.local |
545 | balance roundrobin |
546 | server server_1 127.0.0.1:6083 check inter 2s rise 2 fall 60 maxconn 200 |
547 | |
548 | backend backend-cached-site5 |
549 | - option forwardfor |
550 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
551 | + http-request set-header X-Cache-Request-IP %[src] |
552 | http-request set-header Host site5.local |
553 | balance roundrobin |
554 | server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 200 |
555 | |
556 | backend backend-site5 |
557 | - option redispatch 1 |
558 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
559 | + option redispatch 1 |
560 | http-request set-header Host site5.local |
561 | balance roundrobin |
562 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
563 | |
564 | backend backend-site5-2 |
565 | - option redispatch 1 |
566 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
567 | + option redispatch 1 |
568 | http-request set-header Host site5.local |
569 | balance roundrobin |
570 | server server_1 127.0.1.11:80 check inter 5s rise 2 fall 5 maxconn 200 |
571 | |
572 | backend backend-cached-site6-local |
573 | - option forwardfor |
574 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
575 | + http-request set-header X-Cache-Request-IP %[src] |
576 | http-request set-header Host site6.local |
577 | balance roundrobin |
578 | server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 200 |
579 | |
580 | backend backend-site6-local |
581 | - option redispatch 1 |
582 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
583 | + option redispatch 1 |
584 | http-request set-header Host site6.local |
585 | balance roundrobin |
586 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(site6.local) check-sni site6.local verify required ca-file ca-certificates.crt |
587 | |
588 | backend backend-cached-site7-local |
589 | - option forwardfor |
590 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
591 | + http-request set-header X-Cache-Request-IP %[src] |
592 | http-request set-header Host site7.local |
593 | balance roundrobin |
594 | server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 200 |
595 | |
596 | backend backend-site7-local |
597 | - option redispatch 1 |
598 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
599 | + option redispatch 1 |
600 | http-request set-header Host site7.local |
601 | balance roundrobin |
602 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
603 | |
604 | backend backend-cached-site8-local |
605 | - option forwardfor |
606 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
607 | + http-request set-header X-Cache-Request-IP %[src] |
608 | http-request set-header Host site8.local |
609 | balance roundrobin |
610 | server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 200 |
611 | |
612 | backend backend-site8-local |
613 | - option redispatch 1 |
614 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
615 | + option redispatch 1 |
616 | http-request set-header Host site8.local |
617 | balance roundrobin |
618 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
619 | |
620 | backend backend-site8-local-2 |
621 | - option redispatch 1 |
622 | option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk |
623 | + option redispatch 1 |
624 | http-request set-header Host auth.site8.local |
625 | balance roundrobin |
626 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(auth.site8.local) check-sni auth.site8.local verify required ca-file ca-certificates.crt |
627 | |
628 | backend backend-cached-site9-local |
629 | - option forwardfor |
630 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
631 | + http-request set-header X-Cache-Request-IP %[src] |
632 | http-request set-header Host site9.local |
633 | balance roundrobin |
634 | server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 200 |
635 | |
636 | backend backend-site9-local |
637 | - option redispatch 1 |
638 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
639 | + option redispatch 1 |
640 | http-request set-header Host site9.local |
641 | balance roundrobin |
642 | server server_1 127.0.1.15:80 check inter 1m rise 2 fall 5 maxconn 200 |
643 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt |
644 | index ea91f8d..5e49b0f 100644 |
645 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt |
646 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt |
647 | @@ -156,15 +156,15 @@ listen site9-local |
648 | default_backend backend-site9-local |
649 | |
650 | backend backend-cached-site1-local |
651 | - option forwardfor |
652 | option httpchk HEAD /?token=1861920000_f3e404e205ed44749e942d481f7a7bec57c5e78a HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
653 | + http-request set-header X-Cache-Request-IP %[src] |
654 | http-request set-header Host site1.local |
655 | balance leastconn |
656 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 600 |
657 | |
658 | backend backend-site1-local |
659 | - option redispatch 1 |
660 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
661 | + option redispatch 1 |
662 | http-request set-header Host site1.local |
663 | balance leastconn |
664 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
665 | @@ -172,15 +172,15 @@ backend backend-site1-local |
666 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
667 | |
668 | backend backend-cached-site2-local |
669 | - option forwardfor |
670 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
671 | + http-request set-header X-Cache-Request-IP %[src] |
672 | http-request set-header Host site2.local |
673 | balance leastconn |
674 | server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 3072 |
675 | |
676 | backend backend-site2-local |
677 | - option redispatch 1 |
678 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
679 | + option redispatch 1 |
680 | http-request set-header Host site2.local |
681 | balance leastconn |
682 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
683 | @@ -188,17 +188,17 @@ backend backend-site2-local |
684 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
685 | |
686 | backend backend-cached-site3-local |
687 | - option forwardfor |
688 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
689 | + http-request set-header X-Cache-Request-IP %[src] |
690 | http-request set-header Host site3.local |
691 | balance leastconn |
692 | server server_1 127.0.0.1:6082 check inter 2s rise 2 fall 60 maxconn 4096 |
693 | |
694 | backend backend-site3-local |
695 | - option forwardfor except 127.0.0.1 |
696 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
697 | + option forwardfor except 127.0.0.1 192.168.1.1 |
698 | option forceclose |
699 | option redispatch 1 |
700 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
701 | http-request set-header Host site3.local |
702 | balance leastconn |
703 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
704 | @@ -206,92 +206,92 @@ backend backend-site3-local |
705 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
706 | |
707 | backend backend-cached-site4-local |
708 | - option forwardfor |
709 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site4.local\r\nUser-Agent:\ haproxy/httpchk |
710 | + http-request set-header X-Cache-Request-IP %[src] |
711 | http-request set-header Host site4.local |
712 | balance leastconn |
713 | server server_1 127.0.0.1:6083 check inter 2s rise 2 fall 60 maxconn 200 |
714 | |
715 | backend backend-cached-site5 |
716 | - option forwardfor |
717 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
718 | + http-request set-header X-Cache-Request-IP %[src] |
719 | http-request set-header Host site5.local |
720 | balance leastconn |
721 | server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 200 |
722 | |
723 | backend backend-site5 |
724 | - option redispatch 1 |
725 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
726 | + option redispatch 1 |
727 | http-request set-header Host site5.local |
728 | balance leastconn |
729 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
730 | |
731 | backend backend-site5-2 |
732 | - option redispatch 1 |
733 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
734 | + option redispatch 1 |
735 | http-request set-header Host site5.local |
736 | balance leastconn |
737 | server server_1 127.0.1.11:80 check inter 5s rise 2 fall 5 maxconn 200 |
738 | |
739 | backend backend-cached-site6-local |
740 | - option forwardfor |
741 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
742 | + http-request set-header X-Cache-Request-IP %[src] |
743 | http-request set-header Host site6.local |
744 | balance leastconn |
745 | server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 200 |
746 | |
747 | backend backend-site6-local |
748 | - option redispatch 1 |
749 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
750 | + option redispatch 1 |
751 | http-request set-header Host site6.local |
752 | balance leastconn |
753 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(site6.local) check-sni site6.local verify required ca-file ca-certificates.crt |
754 | |
755 | backend backend-cached-site7-local |
756 | - option forwardfor |
757 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
758 | + http-request set-header X-Cache-Request-IP %[src] |
759 | http-request set-header Host site7.local |
760 | balance leastconn |
761 | server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 200 |
762 | |
763 | backend backend-site7-local |
764 | - option redispatch 1 |
765 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
766 | + option redispatch 1 |
767 | http-request set-header Host site7.local |
768 | balance leastconn |
769 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
770 | |
771 | backend backend-cached-site8-local |
772 | - option forwardfor |
773 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
774 | + http-request set-header X-Cache-Request-IP %[src] |
775 | http-request set-header Host site8.local |
776 | balance leastconn |
777 | server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 200 |
778 | |
779 | backend backend-site8-local |
780 | - option redispatch 1 |
781 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
782 | + option redispatch 1 |
783 | http-request set-header Host site8.local |
784 | balance leastconn |
785 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
786 | |
787 | backend backend-site8-local-2 |
788 | - option redispatch 1 |
789 | option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk |
790 | + option redispatch 1 |
791 | http-request set-header Host auth.site8.local |
792 | balance leastconn |
793 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(auth.site8.local) check-sni auth.site8.local verify required ca-file ca-certificates.crt |
794 | |
795 | backend backend-cached-site9-local |
796 | - option forwardfor |
797 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
798 | + http-request set-header X-Cache-Request-IP %[src] |
799 | http-request set-header Host site9.local |
800 | balance leastconn |
801 | server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 200 |
802 | |
803 | backend backend-site9-local |
804 | - option redispatch 1 |
805 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
806 | + option redispatch 1 |
807 | http-request set-header Host site9.local |
808 | balance leastconn |
809 | server server_1 127.0.1.15:80 check inter 1m rise 2 fall 5 maxconn 200 |
810 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads_haproxy2.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads_haproxy2.txt |
811 | index ef0a365..8cdfd8d 100644 |
812 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads_haproxy2.txt |
813 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads_haproxy2.txt |
814 | @@ -155,16 +155,16 @@ listen site9-local |
815 | default_backend backend-site9-local |
816 | |
817 | backend backend-cached-site1-local |
818 | - option forwardfor |
819 | option httpchk HEAD /?token=1861920000_f3e404e205ed44749e942d481f7a7bec57c5e78a HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
820 | + http-request set-header X-Cache-Request-IP %[src] |
821 | http-request set-header Host site1.local |
822 | balance leastconn |
823 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 600 |
824 | |
825 | backend backend-site1-local |
826 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
827 | retry-on all-retryable-errors |
828 | option redispatch 1 |
829 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
830 | http-request set-header Host site1.local |
831 | balance leastconn |
832 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
833 | @@ -172,16 +172,16 @@ backend backend-site1-local |
834 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
835 | |
836 | backend backend-cached-site2-local |
837 | - option forwardfor |
838 | option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
839 | + http-request set-header X-Cache-Request-IP %[src] |
840 | http-request set-header Host site2.local |
841 | balance leastconn |
842 | server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 3072 |
843 | |
844 | backend backend-site2-local |
845 | + option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
846 | retry-on all-retryable-errors |
847 | option redispatch 1 |
848 | - option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk |
849 | http-request set-header Host site2.local |
850 | balance leastconn |
851 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
852 | @@ -189,18 +189,18 @@ backend backend-site2-local |
853 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
854 | |
855 | backend backend-cached-site3-local |
856 | - option forwardfor |
857 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
858 | + http-request set-header X-Cache-Request-IP %[src] |
859 | http-request set-header Host site3.local |
860 | balance leastconn |
861 | server server_1 127.0.0.1:6082 check inter 2s rise 2 fall 60 maxconn 4096 |
862 | |
863 | backend backend-site3-local |
864 | - option forwardfor except 127.0.0.1 |
865 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
866 | + option forwardfor except 127.0.0.1 192.168.1.1 |
867 | option forceclose |
868 | retry-on all-retryable-errors |
869 | option redispatch 1 |
870 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
871 | http-request set-header Host site3.local |
872 | balance leastconn |
873 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
874 | @@ -208,99 +208,99 @@ backend backend-site3-local |
875 | server server_3 127.0.1.12:80 check inter 5s rise 2 fall 5 maxconn 200 |
876 | |
877 | backend backend-cached-site4-local |
878 | - option forwardfor |
879 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site4.local\r\nUser-Agent:\ haproxy/httpchk |
880 | + http-request set-header X-Cache-Request-IP %[src] |
881 | http-request set-header Host site4.local |
882 | balance leastconn |
883 | server server_1 127.0.0.1:6083 check inter 2s rise 2 fall 60 maxconn 200 |
884 | |
885 | backend backend-cached-site5 |
886 | - option forwardfor |
887 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
888 | + http-request set-header X-Cache-Request-IP %[src] |
889 | http-request set-header Host site5.local |
890 | balance leastconn |
891 | server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 200 |
892 | |
893 | backend backend-site5 |
894 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
895 | retry-on all-retryable-errors |
896 | option redispatch 1 |
897 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
898 | http-request set-header Host site5.local |
899 | balance leastconn |
900 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
901 | |
902 | backend backend-site5-2 |
903 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
904 | retry-on all-retryable-errors |
905 | option redispatch 1 |
906 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk |
907 | http-request set-header Host site5.local |
908 | balance leastconn |
909 | server server_1 127.0.1.11:80 check inter 5s rise 2 fall 5 maxconn 200 |
910 | |
911 | backend backend-cached-site6-local |
912 | - option forwardfor |
913 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
914 | + http-request set-header X-Cache-Request-IP %[src] |
915 | http-request set-header Host site6.local |
916 | balance leastconn |
917 | server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 200 |
918 | |
919 | backend backend-site6-local |
920 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
921 | retry-on all-retryable-errors |
922 | option redispatch 1 |
923 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk |
924 | http-request set-header Host site6.local |
925 | balance leastconn |
926 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(site6.local) check-sni site6.local verify required ca-file ca-certificates.crt |
927 | |
928 | backend backend-cached-site7-local |
929 | - option forwardfor |
930 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
931 | + http-request set-header X-Cache-Request-IP %[src] |
932 | http-request set-header Host site7.local |
933 | balance leastconn |
934 | server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 200 |
935 | |
936 | backend backend-site7-local |
937 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
938 | retry-on all-retryable-errors |
939 | option redispatch 1 |
940 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk |
941 | http-request set-header Host site7.local |
942 | balance leastconn |
943 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
944 | |
945 | backend backend-cached-site8-local |
946 | - option forwardfor |
947 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
948 | + http-request set-header X-Cache-Request-IP %[src] |
949 | http-request set-header Host site8.local |
950 | balance leastconn |
951 | server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 200 |
952 | |
953 | backend backend-site8-local |
954 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
955 | retry-on all-retryable-errors |
956 | option redispatch 1 |
957 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk |
958 | http-request set-header Host site8.local |
959 | balance leastconn |
960 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
961 | |
962 | backend backend-site8-local-2 |
963 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk |
964 | retry-on all-retryable-errors |
965 | option redispatch 1 |
966 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk |
967 | http-request set-header Host auth.site8.local |
968 | balance leastconn |
969 | server server_1 127.0.1.10:443 check inter 5s rise 2 fall 5 maxconn 200 ssl sni str(auth.site8.local) check-sni auth.site8.local verify required ca-file ca-certificates.crt |
970 | |
971 | backend backend-cached-site9-local |
972 | - option forwardfor |
973 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
974 | + http-request set-header X-Cache-Request-IP %[src] |
975 | http-request set-header Host site9.local |
976 | balance leastconn |
977 | server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 200 |
978 | |
979 | backend backend-site9-local |
980 | + option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
981 | retry-on all-retryable-errors |
982 | option redispatch 1 |
983 | - option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk |
984 | http-request set-header Host site9.local |
985 | balance leastconn |
986 | server server_1 127.0.1.15:80 check inter 1m rise 2 fall 5 maxconn 200 |
987 | diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt |
988 | index 8d97a65..150724d 100644 |
989 | --- a/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt |
990 | +++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt |
991 | @@ -90,15 +90,15 @@ listen site1-local |
992 | default_backend backend-site1-local |
993 | |
994 | backend backend-cached-site1-local |
995 | - option forwardfor |
996 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
997 | + http-request set-header X-Cache-Request-IP %[src] |
998 | http-request set-header Host site1.local |
999 | balance leastconn |
1000 | server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 400 |
1001 | |
1002 | backend backend-site1-local |
1003 | - option redispatch 1 |
1004 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk |
1005 | + option redispatch 1 |
1006 | http-request set-header Host site1.local |
1007 | balance leastconn |
1008 | server-template server_1_ 2 _http._tcp.us.archive.ubuntu.com:80 resolvers dns init-addr last,libc,none check inter 5s rise 2 fall 5 maxconn 200 |
1009 | diff --git a/tests/unit/files/haproxy_config_rendered_backends_stanzas_test_output.txt b/tests/unit/files/haproxy_config_rendered_backends_stanzas_test_output.txt |
1010 | index 247c97d..ea47e02 100644 |
1011 | --- a/tests/unit/files/haproxy_config_rendered_backends_stanzas_test_output.txt |
1012 | +++ b/tests/unit/files/haproxy_config_rendered_backends_stanzas_test_output.txt |
1013 | @@ -16,9 +16,9 @@ backend backend-site2-local |
1014 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
1015 | |
1016 | backend backend-site3-local |
1017 | - option forwardfor except 127.0.0.1 |
1018 | - option forceclose |
1019 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
1020 | + option forwardfor except 127.0.0.1 192.168.1.1 |
1021 | + option forceclose |
1022 | http-request set-header Host site3.local |
1023 | balance leastconn |
1024 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
1025 | diff --git a/tests/unit/files/haproxy_config_rendered_test_output.txt b/tests/unit/files/haproxy_config_rendered_test_output.txt |
1026 | index 290d918..1b15c14 100644 |
1027 | --- a/tests/unit/files/haproxy_config_rendered_test_output.txt |
1028 | +++ b/tests/unit/files/haproxy_config_rendered_test_output.txt |
1029 | @@ -122,9 +122,9 @@ backend backend-site2-local |
1030 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
1031 | |
1032 | backend backend-site3-local |
1033 | - option forwardfor except 127.0.0.1 |
1034 | - option forceclose |
1035 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
1036 | + option forwardfor except 127.0.0.1 192.168.1.1 |
1037 | + option forceclose |
1038 | http-request set-header Host site3.local |
1039 | balance leastconn |
1040 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
1041 | diff --git a/tests/unit/files/haproxy_config_rendered_test_output2.txt b/tests/unit/files/haproxy_config_rendered_test_output2.txt |
1042 | index 7489f26..1009f68 100644 |
1043 | --- a/tests/unit/files/haproxy_config_rendered_test_output2.txt |
1044 | +++ b/tests/unit/files/haproxy_config_rendered_test_output2.txt |
1045 | @@ -122,9 +122,9 @@ backend backend-site2-local |
1046 | server server_3 127.0.1.12:443 check inter 5s rise 2 fall 5 maxconn 1024 ssl sni str(site2.local) check-sni site2.local verify required ca-file ca-certificates.crt |
1047 | |
1048 | backend backend-site3-local |
1049 | - option forwardfor except 127.0.0.1 |
1050 | - option forceclose |
1051 | option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk |
1052 | + option forwardfor except 127.0.0.1 192.168.1.1 |
1053 | + option forceclose |
1054 | http-request set-header Host site3.local |
1055 | balance leastconn |
1056 | server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 200 |
A real fix is to set a new header with the client's IP and update Nginx to log that. I'll do that in another MP.