issue with capturing server name
Igor Sysoev
igor at sysoev.ru
Sun Dec 12 21:58:06 MSK 2010
On Sun, Dec 12, 2010 at 07:26:23PM +0100, Sven 'Darkman' Michels wrote:
> 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?
If you run nginx with debug log:
http://nginx.org/en/docs/debugging_log.html
you should see something like this:
http header: "Host: www.internal.mydonain.tld"
...
http regex set $domain to "www"
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list