Skip to main content
Known Participant
June 3, 2011
Question

cgi.server_name

  • June 3, 2011
  • 1 reply
  • 3716 views

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

    This topic has been closed for replies.

    1 reply

    ilssac
    Inspiring
    June 3, 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

    fs22Author
    Known Participant
    June 3, 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.

    ilssac
    Inspiring
    June 3, 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.