From edc41b48d16f2d67ce2d942cb2dc3ae4fc4abbe6 Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 3 May 2017 22:26:10 +0200 Subject: [PATCH] Add map for scheme... --- data/conf/nginx/site.conf | 40 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/data/conf/nginx/site.conf b/data/conf/nginx/site.conf index edd57d32..ef6ec107 100644 --- a/data/conf/nginx/site.conf +++ b/data/conf/nginx/site.conf @@ -1,4 +1,8 @@ proxy_cache_path /tmp levels=1:2 keys_zone=sogo:10m inactive=24h max_size=1g; +map $http_x_forwarded_proto $client_req_scheme { + default $scheme; + https https; +} server { include /etc/nginx/conf.d/listen_ssl.active; include /etc/nginx/mime.types; @@ -34,7 +38,7 @@ server { real_ip_recursive on; location = /principals/ { - rewrite ^ $scheme://$http_host/SOGo/dav; + rewrite ^ $client_req_scheme://$http_host/SOGo/dav; allow all; } @@ -61,17 +65,17 @@ server { } location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass phpfpm:9000; - include /etc/nginx/fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files /autodiscover.php =404; } location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass phpfpm:9000; - include /etc/nginx/fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files /autoconfig.php =404; } @@ -92,7 +96,7 @@ server { proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-server-name $server_name; - proxy_set_header x-webobjects-server-url $scheme://$http_host; + proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host; proxy_set_header x-webobjects-server-port $server_port; client_body_buffer_size 128k; client_max_body_size 100m; @@ -106,7 +110,7 @@ server { proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-server-name $server_name; - proxy_set_header x-webobjects-server-url $scheme://$http_host; + proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host; proxy_set_header x-webobjects-server-port $server_port; client_body_buffer_size 128k; client_max_body_size 100m; @@ -179,7 +183,7 @@ server { real_ip_recursive on; location = /principals/ { - rewrite ^ $scheme://$http_host/SOGo/dav; + rewrite ^ $client_req_scheme://$http_host/SOGo/dav; allow all; } @@ -206,17 +210,17 @@ server { } location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass phpfpm:9000; - include /etc/nginx/fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files /autodiscover.php =404; } location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass phpfpm:9000; - include /etc/nginx/fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files /autoconfig.php =404; } @@ -237,7 +241,7 @@ server { proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-server-name $server_name; - proxy_set_header x-webobjects-server-url $scheme://$http_host; + proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host; proxy_set_header x-webobjects-server-port $server_port; client_body_buffer_size 128k; client_max_body_size 100m; @@ -251,7 +255,7 @@ server { proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-server-name $server_name; - proxy_set_header x-webobjects-server-url $scheme://$http_host; + proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host; proxy_set_header x-webobjects-server-port $server_port; client_body_buffer_size 128k; client_max_body_size 100m;