Do you mean the SERVER_NAME environment variable defined by the CGI/1.1 specification? That environment variable is supposed to contain the "server's hostname, DNS alias, or IP address", so it would be an error for it to contain an URL. (You can read the CGI/1.1 specification at http://hoohoo.ncsa.uiuc.edu/cgi/interface.html)
Perhaps you should try using the SERVER_URL environment variable?
I am trying to set the webserver instance up so the cgi.server_name value is the fully qualified name of the server. One of our apps is programmed so that someone just enters the short name of the server, it redirects them to the fully qualified name of the server by using the cgi.server_name.