| @@ -15,7 +15,7 @@ | |||||
| - name: Generate Etherpad proxying configuration for matrix-nginx-proxy | - name: Generate Etherpad proxying configuration for matrix-nginx-proxy | ||||
| set_fact: | set_fact: | ||||
| matrix_etherpad_matrix_nginx_proxy_configuration: | | matrix_etherpad_matrix_nginx_proxy_configuration: | | ||||
| rewrite ^{{ matrix_etherpad_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_header_value }}://$server_name{{ matrix_etherpad_public_endpoint }}/ permanent; | |||||
| rewrite ^{{ matrix_etherpad_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_etherpad_public_endpoint }}/ permanent; | |||||
| location {{ matrix_etherpad_public_endpoint }}/ { | location {{ matrix_etherpad_public_endpoint }}/ { | ||||
| {% if matrix_nginx_proxy_enabled|default(False) %} | {% if matrix_nginx_proxy_enabled|default(False) %} | ||||
| @@ -27,7 +27,7 @@ | |||||
| proxy_http_version 1.1; # recommended with keepalive connections | proxy_http_version 1.1; # recommended with keepalive connections | ||||
| proxy_pass_header Server; | proxy_pass_header Server; | ||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; # for EP to set secure cookie flag when https is used | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; # for EP to set secure cookie flag when https is used | |||||
| # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html | # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html | ||||
| proxy_set_header Upgrade $http_upgrade; | proxy_set_header Upgrade $http_upgrade; | ||||
| proxy_set_header Connection $connection_upgrade; | proxy_set_header Connection $connection_upgrade; | ||||
| @@ -44,7 +44,7 @@ matrix_nginx_proxy_https_enabled: true | |||||
| # | # | ||||
| # Required if you disable HTTPS for the container (see `matrix_nginx_proxy_https_enabled`) and have an upstream server handle it instead. | # Required if you disable HTTPS for the container (see `matrix_nginx_proxy_https_enabled`) and have an upstream server handle it instead. | ||||
| matrix_nginx_proxy_trust_forwarded_proto: false | matrix_nginx_proxy_trust_forwarded_proto: false | ||||
| matrix_nginx_proxy_x_forwarded_header_value: "{{ '$http_x_forwarded_proto' if matrix_nginx_proxy_trust_forwarded_proto else '$scheme' }}" | |||||
| matrix_nginx_proxy_x_forwarded_proto_value: "{{ '$http_x_forwarded_proto' if matrix_nginx_proxy_trust_forwarded_proto else '$scheme' }}" | |||||
| # Controls whether the matrix-nginx-proxy container exposes its HTTP port (tcp/8080 in the container). | # Controls whether the matrix-nginx-proxy container exposes its HTTP port (tcp/8080 in the container). | ||||
| # | # | ||||
| @@ -59,7 +59,7 @@ | |||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| } | } | ||||
| {% endif %} | {% endif %} | ||||
| @@ -77,7 +77,7 @@ | |||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| } | } | ||||
| {% endif %} | {% endif %} | ||||
| @@ -112,7 +112,7 @@ | |||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| } | } | ||||
| {% endif %} | {% endif %} | ||||
| @@ -137,7 +137,7 @@ | |||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| client_body_buffer_size 25M; | client_body_buffer_size 25M; | ||||
| client_max_body_size {{ matrix_nginx_proxy_proxy_matrix_client_api_client_max_body_size_mb }}M; | client_max_body_size {{ matrix_nginx_proxy_proxy_matrix_client_api_client_max_body_size_mb }}M; | ||||
| @@ -152,7 +152,7 @@ | |||||
| #} | #} | ||||
| location ~* ^/$ { | location ~* ^/$ { | ||||
| {% if matrix_nginx_proxy_proxy_matrix_client_redirect_root_uri_to_domain %} | {% if matrix_nginx_proxy_proxy_matrix_client_redirect_root_uri_to_domain %} | ||||
| return 302 {{ matrix_nginx_proxy_x_forwarded_header_value }}://{{ matrix_nginx_proxy_proxy_matrix_client_redirect_root_uri_to_domain }}$request_uri; | |||||
| return 302 {{ matrix_nginx_proxy_x_forwarded_proto_value }}://{{ matrix_nginx_proxy_proxy_matrix_client_redirect_root_uri_to_domain }}$request_uri; | |||||
| {% else %} | {% else %} | ||||
| rewrite ^/$ /_matrix/static/ last; | rewrite ^/$ /_matrix/static/ last; | ||||
| {% endif %} | {% endif %} | ||||
| @@ -283,7 +283,7 @@ server { | |||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| client_body_buffer_size 25M; | client_body_buffer_size 25M; | ||||
| client_max_body_size {{ matrix_nginx_proxy_proxy_matrix_federation_api_client_max_body_size_mb }}M; | client_max_body_size {{ matrix_nginx_proxy_proxy_matrix_federation_api_client_max_body_size_mb }}M; | ||||
| @@ -71,7 +71,7 @@ | |||||
| proxy_set_header Connection "upgrade"; | proxy_set_header Connection "upgrade"; | ||||
| proxy_set_header Upgrade $http_upgrade; | proxy_set_header Upgrade $http_upgrade; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| tcp_nodelay on; | tcp_nodelay on; | ||||
| } | } | ||||
| {% endmacro %} | {% endmacro %} | ||||
| @@ -29,7 +29,7 @@ | |||||
| proxy_set_header Host $host; | proxy_set_header Host $host; | ||||
| proxy_set_header X-Forwarded-For $remote_addr; | proxy_set_header X-Forwarded-For $remote_addr; | ||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_header_value }}; | |||||
| proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; | |||||
| } | } | ||||
| {% endmacro %} | {% endmacro %} | ||||
| @@ -22,8 +22,8 @@ | |||||
| - name: Generate matrix-registration proxying configuration for matrix-nginx-proxy | - name: Generate matrix-registration proxying configuration for matrix-nginx-proxy | ||||
| set_fact: | set_fact: | ||||
| matrix_registration_matrix_nginx_proxy_configuration: | | matrix_registration_matrix_nginx_proxy_configuration: | | ||||
| rewrite ^{{ matrix_registration_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_header_value }}://$server_name{{ matrix_registration_public_endpoint }}/ permanent; | |||||
| rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_header_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect; | |||||
| rewrite ^{{ matrix_registration_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/ permanent; | |||||
| rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect; | |||||
| location ~ ^{{ matrix_registration_public_endpoint }}/(.*) { | location ~ ^{{ matrix_registration_public_endpoint }}/(.*) { | ||||
| {% if matrix_nginx_proxy_enabled|default(False) %} | {% if matrix_nginx_proxy_enabled|default(False) %} | ||||
| @@ -22,7 +22,7 @@ | |||||
| - name: Generate Synapse Admin proxying configuration for matrix-nginx-proxy | - name: Generate Synapse Admin proxying configuration for matrix-nginx-proxy | ||||
| set_fact: | set_fact: | ||||
| matrix_synapse_admin_matrix_nginx_proxy_configuration: | | matrix_synapse_admin_matrix_nginx_proxy_configuration: | | ||||
| rewrite ^{{ matrix_synapse_admin_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_header_value }}://$server_name{{ matrix_synapse_admin_public_endpoint }}/ permanent; | |||||
| rewrite ^{{ matrix_synapse_admin_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_synapse_admin_public_endpoint }}/ permanent; | |||||
| location ~ ^{{ matrix_synapse_admin_public_endpoint }}/(.*) { | location ~ ^{{ matrix_synapse_admin_public_endpoint }}/(.*) { | ||||
| {% if matrix_nginx_proxy_enabled|default(False) %} | {% if matrix_nginx_proxy_enabled|default(False) %} | ||||