Skip to content

Commit

Permalink
Use include files for re-using HTTP/3 specific nginx directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
strarsis committed Jul 30, 2024
1 parent 7b6e711 commit 01d6ea8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
7 changes: 7 additions & 0 deletions roles/wordpress-setup/tasks/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@

- import_tasks: "{{ playbook_dir }}/roles/common/tasks/disable_challenge_sites.yml"

- name: Copy Nginx wordpress site configs
copy:
src: templates/includes
dest: "{{ nginx_path }}"
mode: '0755'
notify: reload nginx

- name: Create Nginx available sites
template:
src: "{{ item.src }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add Alt-Svc header to negotiate HTTP/3 (when redirecting from HTTP).
add_header alt-svc 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add Alt-Svc header to negotiate HTTP/3.
add_header alt-svc 'h3=":443"; ma=86400';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
quic_retry on;

# enable 0-RTT
ssl_early_data on;
proxy_set_header Early-Data $ssl_early_data;

quic_gso on;
23 changes: 5 additions & 18 deletions roles/wordpress-setup/templates/wordpress-site.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ server {
{% endblock %}

{% if ssl_enabled and nginx_http3_enabled -%}
quic_retry on;
# enable 0-RTT
ssl_early_data on;
proxy_set_header Early-Data $ssl_early_data;
quic_gso on;

# Add Alt-Svc header to negotiate HTTP/3.
add_header alt-svc 'h3=":443"; ma=86400';
include includes/directive-only/http3-tune.conf;
include includes/directive-only/http3-negotiate.conf;
{% endif -%}

{% block server_basic -%}
Expand Down Expand Up @@ -296,8 +290,7 @@ server {
{{ self.includes_d() -}}

{% if ssl_enabled and nginx_http3_enabled -%}
# Add Alt-Svc header to negotiate HTTP/3 (when redirecting from HTTP).
add_header alt-svc 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400';
include includes/directive-only/http3-negotiate-redirect.conf;
{% endif -%}

location / {
Expand Down Expand Up @@ -333,14 +326,8 @@ server {
server_name {{ host.redirects | join(' ') }};

{% if ssl_enabled and nginx_http3_enabled -%}
quic_retry on;
# enable 0-RTT
ssl_early_data on;
proxy_set_header Early-Data $ssl_early_data;
quic_gso on;

# Add Alt-Svc header to negotiate HTTP/3 (when redirecting from HTTP).
add_header alt-svc 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400';
include includes/directive-only/http3-tune.conf;
include includes/directive-only/http3-negotiate-redirect.conf;
{% endif -%}

{{ self.https() -}}
Expand Down

0 comments on commit 01d6ea8

Please sign in to comment.