issue with capturing server name

Sven 'Darkman' Michels sven at darkman.de
Sun Dec 12 21:26:23 MSK 2010


Hi,

on http://wiki.nginx.org/HttpCoreModule#server_name i read about capturing
the servername with regular expressions. Now i used the following on nginx
0.9.2:

  server {
    listen  [::]:80 default ipv6only=off;
    server_name ~^(?<domain>.+)\.internal\.mydomain\.tld$;

    location / {
            proxy_pass             http://1.2.3.4:80;
            proxy_set_header       Host $domain;

   }
  }

but Host is not set at all on the upstream, because it seems that nginx
doesn't get it captured. The regexp matches, i also tried with ?P<domain>
as stated on the page with no success. Anything i'm doing wrong here?

Thanks and regards,
Sven



More information about the nginx mailing list