Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cgi.server_name

New Here ,
Jun 03, 2011 Jun 03, 2011

I have a client that installed a new server (Windows 2008 R2 with iis 7.5 and CF9.01). We just went live and noticed an issue with some scripts running that use cgi.server_name. These scripts that I built use to pull the DNS name (www.domainname.com). Now they are pulling the IP address, which is causing some scripting issues. I am trying to figure out where the cgi.server_name is pulling from so I can fix this.I have been unsuccessful thus far. Has anyone eer run into this and been able to fix it? Is it the binding in IIS or something?

~Clay

3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 03, 2011 Jun 03, 2011

fs22 wrote:

Is it the binding in IIS or something?

~Clay

AFAIK, it is populated by IIS (or other web server of choice), yes.  In my experience, the value is whatever was used to make the HTTP request by the client.  I.E. if the client made a request to "www.mywebsite.org" then cgi.server_name would be "www.mywebsite.org".  If the request was for 10.104.106.99 then that would be the value of cgi.server_name.

HTH

Ian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2011 Jun 03, 2011

That is actually what I thought as well, but I think I am wrong. Because in this case, I did surf to it using the DNS name and the cgi.server_name variable was returning the IP. Hence my confusion.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 03, 2011 Jun 03, 2011

Any chance there is some type of redirect going on somewhere?  So that you start out requesting www.aDomain.name but some system is redirecting that to 10.104.106.55 and thus that redirect request is what the web server is seeing and responding.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2011 Jun 03, 2011

There's a bunch of stuff on Google regarding IIS returning an IP address instead of host name for this value, which list settings to check etc.  Did you read that lot.

I just googled "iis server_name ip address" and stuff like that.

Is there anything there that helps?

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2011 Jun 03, 2011

There is no redirect occuring and I did the Google thing prior to posting here

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2011 Jun 03, 2011

So did you check what the metabase has got set for the serhostname value?

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2011 Jun 03, 2011

I did not check that but I think I have found the culprit and now need to find a solution. Here is what seems to be happening. My IT team is working on implementing a load balancing switch, but that is not in place yet. So we are going through a proxy server and doing what I would call 'quasi-load balancing'. Meaning the proxy gets the http request and translates that to an IP of one of our servers (we have two) and passes the request along. So by the time the http request hits the CF server, the DNS has been stripped and replaced with the local IP of the server and hence the cgi.server_name is working exactly as it is supposed to. Now I need to figure out how to pass through the domain name.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 03, 2011 Jun 03, 2011

That would indeed make perfect sense. Some balancers I've worked with it's a simple fix, you just set it up as a proxy or not. Others (Zeus I think) you can only pass the original request as an additional custom header, which you then have to try and pull out manually.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2011 Jun 03, 2011

There's a CGI variable which will hold it, but I'm buggered if I can remember what it is.  And it's not shown in a CGI key array or a dump of the CGI scope.

It's CGI.x-original-address or something like that (but not that).

I've got it somewhere, I'll dig it out...

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 03, 2011 Jun 03, 2011

I would just like to point out that a Proxy server, as you have described it in this post, is SOME TYPE OF REDIRECT 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 03, 2011 Jun 03, 2011

I would just like to point out that a Proxy server, as you have described it in this post, is SOME TYPE OF REDIRECT 🙂

Well yes, but it depends on which exciting layer of the OSI model you want that redirect to occur at

Snooooooorrrrrrrrrrre

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 03, 2011 Jun 03, 2011

Owainnorth wrote:

Snooooooorrrrrrrrrrre

I'm not sure why YOU are sorry (or snoring) Owain.

I was jibing the Origianl Poster, fs22, who in his|her second post said there was no redirect then in his|hir third post described a Proxy server doing a redirect.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 03, 2011 Jun 03, 2011

Ah I see, apologies. Thought you were pointing out that even my usual level of dull could be made further tedious by delving into the different methods of throwing packets around.

Yes, hadn't spotted that little gaff by the OP. No redirection here, just loadbalancing (?).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2011 Jun 03, 2011
LATEST

RE: Concerning my statement about no redirects and then mentioning load balacning. Until I dug into this with the IT team and they informed me, I had no idea that was occurring. SO from my vantage point, there was no redirection occurring at that time.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources