map $scheme:$host $krdsh_need_ssl { default 1; ~*^[^:]+:(?:nossl-)?geo-[^.]+\.krd\.sh$ ""; ~*^https: ""; ~*^http:nossl- ""; } map $scheme:$host $krdsh_is_ssl { ~*^https:nossl- ""; ~*^https: 1; } map $scheme:$host $krdsh_nossl_misuse { ~*^https:nossl- 1; } map $host $krdsh_nossl_realhost { ~*^nossl-(.+)$ $1; } map $scheme:$host $krdsh_need_redirect { ~*^[^:]+:nossl-geo\.krd\.sh$ 1; ~*^[^:]+:(?:nossl-)?geo-[^.]+\.krd\.sh$ 1; } map $scheme:$host $krdsh_redirector { default http://krd.sh; ~*^[^:]+:nossl-geo\.krd\.sh$ $scheme://geo.krd.sh$uri; ~*^[^:]+:(?:nossl-)?geo-([^.]+)\.krd\.sh$ $scheme://geo.krd.sh/$1; } map $krdsh_need_ssl$krdsh_is_ssl$krdsh_need_redirect $krdsh_need_proxy { "" 1; } map $host $krdsh_self_proxy_host { default $host; ~*^nossl-(.+)$ $1; } map $host $krdsh_self_proxy_uri { default https://$host; ~*^nossl-(.+)$ https://$1; }