sero/nginx-templates/default.conf.template
2024-06-24 12:50:35 +03:00

18 lines
609 B
Text

server {
# We check if $subdomain is not empty and if the X-subdomain header is not present in the request
# ($http_x_subdomain = "").
# If both conditions are met, we set the X-subdomain header using proxy_set_header.
# Otherwise, we do nothing, and the existing X-subdomain header (if any) will be preserved.
listen 80;
server_name ~^(?<subdomain>\w*)\.${DOMAIN}.${ZONE}${DOLLAR};
location / {
if ($subdomain != "" && $http_x_subdomain = "") {
proxy_set_header x-subdomain $subdomain;
}
proxy_pass http://${SERVER}:${SERVER_PORT}/;
}
}