From ab1b5a7c655ab9ab32216fbae066bb48b1d42dfd Mon Sep 17 00:00:00 2001 From: Mo Balaa Date: Wed, 8 May 2024 00:41:44 -0500 Subject: [PATCH] Fix http routing when specifying a sub-subdomain --- src/gateway/http.conf.template | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gateway/http.conf.template b/src/gateway/http.conf.template index 3d5c7e2..53b872e 100644 --- a/src/gateway/http.conf.template +++ b/src/gateway/http.conf.template @@ -5,11 +5,15 @@ server { server_name "~^(?.+?)?\.(?.+?)?\.(?.+)\.(?.+)$" "~^(?.+)\.(?.+)\.(?.+)$" "~^(?.+)\.(?.+)$"; #access_log /var/log/nginx/host.access.log main; - set $target http://$subdomain-$domain-$tld; + set $target http://$subdomain-$domain-$tld; + + if ($app != '') { + set $target http://$app-$subdomain-$domain-$tld; + } + if ($subdomain = '') { set $target http://$domain-$tld; } - location /test { add_header Content-Type text/plain; return 200 "target: $target \napp: $app - subdomain: $subdomain - domain: $domain.$tld";