1

I'm having troubles setting up a reverse proxy for a sub-subdomain using nginx.

I'm trying to create a configuration which allows me to resolve:

a.b.example.com ==> a.local.host.lan

Currently i am able to resolve it as follows:

a.b.example.com ==> a.b.local.host.lan

with following configuration:

server {
    listen 80;
    server_name ~^(.*)\.b.example\.com$;
    set $servername $1;
    rewrite ^(.*)$ https://$servername.local.host.lan;
}

any idea how to tokenize the $servername variable so i can split a and b?

0 Answers0