Help Required: Host name modification

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.

On Tue, Jul 27, 2010 at 10:12 AM, Sougata Pal. [email protected]
wrote:

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 D…

Hi,

I have tried the following config, but it is generating error while
restarting the server.

*Error: *[emerg]: unknown “new_host” variable

server {
listen 80;
server_name ~(?P<new_host>.*).xyz.com;
error_log “/srv/logs/xyz.com.error”;

gzip on;
default_type text/html;

location / {
proxy_pass http://$new_host:80;
proxy_set_header Host $new_host;
proxy_set_header X-Real-IP $remote_addr;
}
}

Hello!

On Tue, Jul 27, 2010 at 04:58:49PM +0530, Sougata Pal. wrote:

I have tried the following config, but it is generating error while
restarting the server.

*Error: *[emerg]: unknown “new_host” variable

server {
listen 80;
server_name ~(?P<new_host>.*).xyz.com;

Named captures in regular expression are supported in 0.8.25+.
You are probably using an older version.

Maxim D.