What *exactly* does cgi.server_name return.
I think I can get the answer faster from this helpful and generous group of people then I can write one line of code and try it out on a wide variety of environments. What exactly is cgi.server_name expected to return? Looking at the following examples what would you expect to be in this variable? http://calpip-devsite/index.cfm http://calpip.cdpr.ca.gov/index.cfm http://calpip-devsite.inisde.cdpr.ca.gov/index.cfm http://10.104.106.113/index.cfm http://134.186.118.90/index.cfm/ TIA Ian ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320460 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: What *exactly* does cgi.server_name return.
http://134.139.143.25/stompy/server.cfm or http://cfdev.cota.csulb.edu/stompy/server.cfm both return: CGI.SERVER_NAME: cfdev.cota.csulb.edu It looks like it returns the name registered in the web server (apache, in my case). The above addresses both go to the same server. Mike Ian Skinner wrote: I think I can get the answer faster from this helpful and generous group of people then I can write one line of code and try it out on a wide variety of environments. What exactly is cgi.server_name expected to return? Looking at the following examples what would you expect to be in this variable? http://calpip-devsite/index.cfm http://calpip.cdpr.ca.gov/index.cfm http://calpip-devsite.inisde.cdpr.ca.gov/index.cfm http://10.104.106.113/index.cfm http://134.186.118.90/index.cfm/ TIA Ian ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320461 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: What *exactly* does cgi.server_name return.
calpip-devsite/index.cfmcalpip-devsite calpip.cdpr.ca.gov/index.cfmcalpip.cdpr.ca.gov calpip-devsite.inisde.cdpr.ca.gov/index.cfm calpip-devsite.inisde.cdpr.ca.gov 10.104.106.113/index.cfm10.104.106.113 134.186.118.90/index.cfm/ 134.186.118.90 But, I did read somewhere that depending on your set up, either SERVER_NAME or the other one that looks like it returns the same thing can include the port. Google for something like difference between SERVER_NAME and [some other CGI var that I can't remember] and you'll come across a post or two that explains what it returns. Or not :OD Adrian -Original Message- From: Ian Skinner [mailto:h...@ilsweb.com] Sent: 12 March 2009 17:20 To: cf-talk Subject: What *exactly* does cgi.server_name return. I think I can get the answer faster from this helpful and generous group of people then I can write one line of code and try it out on a wide variety of environments. What exactly is cgi.server_name expected to return? Looking at the following examples what would you expect to be in this variable? http://calpip-devsite/index.cfm http://calpip.cdpr.ca.gov/index.cfm http://calpip-devsite.inisde.cdpr.ca.gov/index.cfm http://10.104.106.113/index.cfm http://134.186.118.90/index.cfm/ TIA Ian ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320462 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: What *exactly* does cgi.server_name return.
Adrian Lynch wrote: calpip-devsite/index.cfm calpip-devsite calpip.cdpr.ca.gov/index.cfm calpip.cdpr.ca.gov calpip-devsite.inisde.cdpr.ca.gov/index.cfm calpip-devsite.inisde.cdpr.ca.gov 10.104.106.113/index.cfm 10.104.106.113 134.186.118.90/index.cfm/ 134.186.118.90 That is what I thought, but I wasn't 100% certain about the behavior with domains and sub-domains and potential IP addresses. And I just did not have a quick and easy variety of these options for testing to see for myself. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320464 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: What *exactly* does cgi.server_name return.
I thought I'd add to this: http://134.139.143.25/stompy/server.cfm http://cfdev.cota.csulb.edu/stompy/server.cfm http://servername/stompy/server.cfm http://servername.ad.dns.entry/stompy/server.cfm http://localhost/stompy/server.cfm all return: CGI.SERVER_NAME: cfdev.cota.csulb.edu I do have the servername set to cfdev.cota.csulb.edu in the httpd.conf file. Mike Mike Soultanian wrote: http://134.139.143.25/stompy/server.cfm or http://cfdev.cota.csulb.edu/stompy/server.cfm both return: CGI.SERVER_NAME: cfdev.cota.csulb.edu It looks like it returns the name registered in the web server (apache, in my case). The above addresses both go to the same server. Mike Ian Skinner wrote: I think I can get the answer faster from this helpful and generous group of people then I can write one line of code and try it out on a wide variety of environments. What exactly is cgi.server_name expected to return? Looking at the following examples what would you expect to be in this variable? http://calpip-devsite/index.cfm http://calpip.cdpr.ca.gov/index.cfm http://calpip-devsite.inisde.cdpr.ca.gov/index.cfm http://10.104.106.113/index.cfm http://134.186.118.90/index.cfm/ TIA Ian ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320465 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: What *exactly* does cgi.server_name return.
Ian Skinner wrote: I think I can get the answer faster from this helpful and generous group of people then I can write one line of code and try it out on a wide variety of environments. It depends on the web server. IIS should return whatever is in the domain part of the URL the user used to access the page. Apache uses the host header as set in the server configuration from what I can tell from other responses (I don't use Apache personally). -Justin ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320467 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: What *exactly* does cgi.server_name return.
What exactly is cgi.server_name expected to return? The thing about CGI variables is that these expectations can be pretty vague. CF doesn't control them; they're controlled by the web server and/or the operating system. I would generally expect it to return the server hostname, IP address or DNS alias name used in the URL that got you to the server in the first place, but I wouldn't be completely surprised if it returns something else. If you want to know what it should return generally, you'd go here: http://www.w3.org/CGI/ Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320469 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: What *exactly* does cgi.server_name return.
Since IIS uses the DNS alias in the URL and that can easily be spoof by modifying your HOSTS file, I use a Java class if I need to identify a machine (like for environmental changes). InetAddress = createObject(java, java.net.InetAddress); hostName = InetAddress.getLocalHost().getHostName(); At least in IIS, this returns the fully qualified domain name of the ColdFusion machine. It looks like Mike is using Apache, so this might not be of specific use to him. However, it's here for others to find later. :) Jason ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320480 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4