Help Required: Host name modification.

Boris Dolgov boris at dolgov.name
Tue Jul 27 12:56:33 MSD 2010


On Tue, Jul 27, 2010 at 10:12 AM, Sougata Pal. <skall.paul at gmail.com> wrote:
> Hi,
>
> I need to modify the hostname ( $host ) as follows.
>
> Request Hostname:  xyz.abc.example.com
>
> Required Hostname:  xyz.abc
>
> I am expecting some sort of regex function to be run on $host.
>
> Please feel free to ask questions to know more about my requirement.
server
{
    server_name ~(?P<new_host>.*)\.example\.com;
    location /
    {
        proxy_pass ...;
        proxy_set_header Host $new_host;
    }
}

-- 
Boris Dolgov.



More information about the nginx mailing list