Hide raw regular expression from $_SERVER

I am using a regular expression in a server_name:

     server_name ~^(?!web2\.)(?<account>.+)\.mydomain\.com$;

In PHP, or any language for that matter, if I:

    echo $_SERVER['server_name'];
    //~^(?!web2\.)(?.+)\.mydomain\.com$

I get the raw regular expression back. Is it possible to mask this, and
instead return the actual regular expression matchedaccount? I.E.
foo.mydomain.com.

Posted at Nginx Forum:

On 3 Aug 2013 23:07, “justin” [email protected] wrote:

I get the raw regular expression back. Is it possible to mask this, and
instead return the actual regular expression matchedaccount? I.E.
foo.mydomain.com.

Have you tried looking at the “Host” HTTP header?

J

J,

The “HOST” http-header is correct, I am just wondering if I can modify
or
prevent the raw regular expression being exposed in
$_SERVER[‘server_nam’].

Posted at Nginx Forum:

On Aug 4, 2013, at 2:07 , justin wrote:

instead return the actual regular expression matchedaccount? I.E.
foo.mydomain.com.

You should change in your configuration the following string
fastcgi_param SERVER_NAME $server_name;
to
fastcgi_param SERVER_NAME $host;


Igor S.

On 4 Aug 2013 01:07, “justin” [email protected] wrote:

J,

The “HOST” http-header is correct, I am just wondering if I can modify or
prevent the raw regular expression being exposed in
$_SERVER[‘server_nam’].

Why? The only meaningful information it could hold would be the same as
that passed via the Host header. You already have that information. Just
use the Host header.

J

Great fix Igor. Thanks.

Posted at Nginx Forum: