Skip to content

Commit 7ee4830

Browse files
authored
Drop unsupported "spdy", make "http2" a server level option. (#346)
1 parent d4ece3c commit 7ee4830

File tree

6 files changed

+65
-5
lines changed

6 files changed

+65
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
## 0.6.1 (Unreleased)
44

5+
BREAKING CHANGES:
6+
7+
- `spdy` parameter `listen` is removed
8+
- `http2` parameter for `listen` is removed
9+
510
ENHANCEMENTS:
611

712
- Bump the Ansible `community.general` collection to `7.1.0`, `ansible.posix` collection to `1.5.4`, `community.crypto` collection to `2.14.0`, and `community.docker` collection to `3.4.7`.
13+
- Options from `http_v2` module are implemented.
814

915
BUG FIXES:
1016

defaults/main/template.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ nginx_config_http_template:
204204
port: 80
205205
default_server: true # Boolean
206206
ssl: false # Boolean
207-
http2: false # Boolean
208-
spdy: false # Boolean
209207
proxy_protocol: false # Boolean
210208
fastopen: 12 # Number
211209
backlog: 511 # Number
@@ -273,6 +271,13 @@ nginx_config_http_template:
273271
underscores_in_headers: false # Boolean -- Not available in the 'location' context
274272
variables_hash_bucket_size: 64 # Available only in the 'http' context
275273
variables_hash_max_size: 1024 # Available only in the 'http' context
274+
http2: # Configure HTTP2
275+
enable: false
276+
body_preread_size: 64k
277+
chunk_size: 8k
278+
max_concurrent_streams: 128
279+
recv_buffer_size: 256k
280+
recv_timeout: 20s
276281
ssl: # Configure SSL
277282
buffer_size: 16k
278283
certificate: /path/to/file # String or a list of strings

molecule/default/converge.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@
229229
underscores_in_headers: false
230230
variables_hash_bucket_size: 64
231231
variables_hash_max_size: 1024
232+
http2:
233+
enable: true
234+
body_preread_size: 128k
235+
chunk_size: 8k
236+
max_concurrent_streams: 31
237+
recv_buffer_size: 128k
238+
recv_timeout: 10s
232239
ssl:
233240
buffer_size: 16k
234241
certificate: /etc/ssl/certs/molecule.crt
@@ -548,8 +555,6 @@
548555
port: 80
549556
default_server: true
550557
ssl: false
551-
http2: false
552-
spdy: false
553558
proxy_protocol: false
554559
fastopen: 12
555560
backlog: 511
@@ -577,6 +582,9 @@
577582
try_files:
578583
files: $uri
579584
uri: /images/default.gif
585+
http2:
586+
enable: false
587+
chunk_size: 8k
580588
auth_basic:
581589
realm: false
582590
log:
@@ -653,6 +661,8 @@
653661
core:
654662
index: frontend_index.html
655663
root: /usr/share/nginx/html
664+
http2:
665+
chunk_size: 10k
656666
- location: /alias
657667
core:
658668
alias: /usr/share/nginx/html

templates/http/core.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ lingering_timeout {{ core['lingering_timeout'] }};
141141
listen {{ listen['address'] if listen['address'] is defined }}{{ ':' if listen['address'] is defined and listen['port'] is defined }}{{ listen['port'] if listen['port'] is defined -}}
142142
{{- ' default_server' if listen['default_server'] is defined and listen['default_server'] is boolean and listen['default_server'] | bool -}}
143143
{{- ' ssl' if listen['ssl'] is defined and listen['ssl'] is boolean and listen['ssl'] | bool -}}
144-
{{- ' http2' if listen['http2'] is defined and listen['http2'] is boolean and listen['http2'] | bool else ' spdy' if listen['spdy'] is defined and listen['spdy'] is boolean and listen['spdy'] | bool -}}
145144
{{- ' proxy_protocol' if listen['proxy_protocol'] is defined and listen['proxy_protocol'] is boolean and listen['proxy_protocol'] | bool -}}
146145
{{- (' setfib=' + listen['setfib'] | string) if listen['setfib'] is defined -}}
147146
{{- (' fastopen=' + listen['fastopen'] | string) if listen['fastopen'] is defined and listen['fastopen'] is number -}}

templates/http/default.conf.j2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
{% from 'http/core.j2' import core with context %}
99
{{ core(item['config']['core']) }}
1010
{%- endif %}
11+
{% if item['config']['http2'] is defined %}
12+
{% from 'http/modules.j2' import http2 with context %}
13+
{{ http2(item['config']['http2'], 'http') }}
14+
{%- endif %}
1115
{% if item['config']['ssl'] is defined %}
1216
{% from 'http/ssl.j2' import ssl with context %}
1317
{{ ssl(item['config']['ssl']) }}
@@ -124,6 +128,12 @@ server {
124128
{{ core(server['core']) }}
125129
{%- endfilter %}
126130
{% endif %}
131+
{% if server['http2'] is defined %}
132+
{% from 'http/modules.j2' import http2 with context %}
133+
{% filter indent(4) %}
134+
{{ http2(server['http2'], 'server') }}
135+
{%- endfilter %}
136+
{% endif %}
127137
{% if server['ssl'] is defined %}
128138
{% from 'http/ssl.j2' import ssl with context %}
129139
{% filter indent(4) %}
@@ -278,6 +288,12 @@ server {
278288
{{ core(location['core']) }}
279289
{%- endfilter %}
280290
{% endif %}
291+
{% if location['http2'] is defined %}
292+
{% from 'http/modules.j2' import http2 with context %}
293+
{% filter indent(8) %}
294+
{{ http2(location['http2'], 'location') }}
295+
{%- endfilter %}
296+
{% endif %}
281297
{% if location['app_protect_waf'] is defined %}
282298
{% from 'http/app_protect.j2' import app_protect_waf with context %}
283299
{% filter indent(8) %}

templates/http/modules.j2

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,27 @@ sub_filter_types {{ sub_filter['types'] if sub_filter['types'] is string else su
330330
{% endif %}
331331

332332
{% endmacro %}
333+
334+
{# NGINX HTTP v2 -- ngx_http_v2_module #}
335+
{% macro http2(http2, scope='http') %}
336+
{% if http2 is defined %}
337+
{% if scope != 'location' %}{# The following scoped directives are not available in the 'location' context #}
338+
{% if http2['enabled'] is defined and http2['enabled'] is boolean %}
339+
http2 {{ http2['enabled'] | ternary('on', 'off') }};
340+
{% endif %}
341+
{% if http2['body_preread_size'] is defined %}
342+
http2_body_preread_size {{ http2['body_preread_size'] }};
343+
{% endif %}
344+
{% if http2['max_concurrent_streams'] is defined %}
345+
http2_max_concurrent_streams {{ http2['max_concurrent_streams'] }};
346+
{% endif %}
347+
{% endif %}
348+
{% if scope == 'http' and http2['recv_buffer_size'] is defined %}{# 'recv_buffer_size' directive is only available in the 'http' context #}
349+
http2_recv_buffer_size {{ http2['recv_buffer_size'] }};
350+
{% endif %}
351+
{% if http2['chunk_size'] is defined %}
352+
http2_chunk_size {{ http2['chunk_size'] }};
353+
{% endif %}
354+
{% endif %}
355+
356+
{% endmacro %}

0 commit comments

Comments
 (0)