better nginx support

This commit is contained in:
Emmanuel Garette 2022-03-11 19:55:02 +01:00
parent f49ecd419f
commit bf42da89ac
3 changed files with 11 additions and 30 deletions

View file

@ -0,0 +1 @@
LANG=fr_FR.UTF-8

View file

@ -5,36 +5,15 @@
# Configuration HTTP %%domainname
server {
listen 80;
%if %%wildcard
%set %%prefix = "*."
%else
%set %%prefix = ""
%end if
server_name %%prefix%%domainname;
server_name %%domainname;
error_page 403 404 502 503 504 /error.html;
location = /error.html{
root /var/www/html;
}
%for %%location in %%revprox['revprox_location_' + family]
%set %%location_str = %%str(%%location)
%if %%location_str != '/' and %%location_str.endswith('/')
%set %%location_str = %%location_str[:-1]
%end if
location %%location_str {
%if %%wildcard
if ($host ~* ".%%domainname" ) {
%else
if ($host = "%%domainname" ) {
%end if
location / {
rewrite ^(.*) https://$host$1 permanent;
break;
}
index error.html;
root /var/www/html;
}
# FIXME return 301 https://www.domain.com$request_uri; => https://www.nginx.com/blog/creating-nginx-rewrite-rules/
%end for
}
# Configuration HTTPS %%domainname
@ -50,13 +29,13 @@ server {
}
%for %%location in %%revprox['revprox_location_' + family]
%set %%location_str = %%str(%%location)
location %%location {
# FIXME proxy_bind A.A.A.A;
proxy_pass %%location['revprox_url_' + family];
# %if %%location['revprox_is_websocket_' + family]
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# %else
%if %%location['revprox_is_websocket_' + family]
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
%else
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
@ -65,7 +44,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Destination $dest;
# %end if
%end if
proxy_ssl_trusted_certificate /etc/pki/ca-trust/source/anchors/ca_ReverseProxy.crt;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;

View file

@ -79,7 +79,8 @@
<param name="linked_server" type="variable">revprox_client_server_domainname</param>
<param name="linked_provider">revprox_is_websocket</param>
<param name="dynamic" type="variable">revprox_client_external_domainname</param>
<param name="leader_index" type="index"/>
<param name="leader_provider">revprox_location</param>
<param name="leader_value" type="variable">revprox_client_location</param>
<target>revprox_client_is_websocket</target>
</check>
<check name="set_linked_configuration">