473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Tricky SERVER_NAME and HTTP_HOST return values?

These two server variables should ALWAYS return the domain name of the host:

- Request.ServerVariables("SERVER_NAME")
- Request.ServerVariables("HTTP_HOST")

Under what circumstances can those server variables return the server names of domains
that are completely unrelated to the hosting website???

I know, it's not supposed to work that way, but it is. I'm seeing almost 30,000
accesses/day on an empty website, no less!

For each entry, as a debugging mechanism I decided to log all the
Request.ServerVariables entries, and that's when I noticed the outrageous behavior of
the above two server variables.

How is this technically, possible???

(I should note that Request.ServerVariables("HTTP_REFERER") always returns the proper IP
address for the website. Also, I believe I know WHAT is causing this traffic, but to
prevent defensive answers on this group I don't want to mention that yet.)

THANKS!!!

Bill.

May 2 '07 #1
1 5454

"Bill" <Bi********@nothing.nowrote in message
news:eN**************@TK2MSFTNGP02.phx.gbl...
These two server variables should ALWAYS return the domain name of the
host:
>
- Request.ServerVariables("SERVER_NAME")
- Request.ServerVariables("HTTP_HOST")

Under what circumstances can those server variables return the server
names of domains
that are completely unrelated to the hosting website???

I know, it's not supposed to work that way, but it is. I'm seeing almost
30,000
accesses/day on an empty website, no less!

For each entry, as a debugging mechanism I decided to log all the
Request.ServerVariables entries, and that's when I noticed the outrageous
behavior of
the above two server variables.

How is this technically, possible???

(I should note that Request.ServerVariables("HTTP_REFERER") always returns
the proper IP
address for the website. Also, I believe I know WHAT is causing this
traffic, but to
prevent defensive answers on this group I don't want to mention that yet.)

THANKS!!!

Bill.
In the case of server variables with the HTTP_ prefix these always contain
whatever text is in the Request header with a name matching the rest of the
variable name. All HTTP requests must contain a host: header, however, I'm
not sure what IIS would do it it were left blank.

HTTP_REFERER would therefore return the content of the referer header.
Typically a browser will supply this.

If the client agent added a request header PinkElephants it's value can be
retreived using HTTP_PINKELEPHANTS.

As to the SERVER_NAME I've never found it to return anything other that
whatever HTTP_HOST does regardless of what the documentation says it does.

IOW, the 'outrageous behavior' is likely caused by one of more clients
mis-behaving and is not the fault of server.

May 3 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Leif Wessman | last post by:
I need help creating a regular expression to find the subdomain in the $HTTP_HOST variable. The domain is always in this form: www.domain.com or uk.domain.com or domain.com
3
by: junk | last post by:
Hi can anyone tell me why this doesn't work: <link rel="stylsheet" href="http://<?php echo $_SERVER; ?>/includes/test3.css" type="text/css" /> there is no wrap in the actual file. when I...
2
by: ssk | last post by:
Hello! I made a web site using PHP Open sources for message board. Everything's fine except one computer can't open a message writing page. The code that gives an error is the following. ...
0
by: Patrick | last post by:
Greetings, I'm running into an intermittant issue on a web site running dotNet 1.1 sp1. The global.asax the client is using is set up so that it can be used in production, developement, and...
2
by: E L | last post by:
We have the Request.ServerVariables("SERVER_NAME") used in a classic ASP page using IIS 6. It used to return our website name: www.xxx.name.this when using IIS 5, now it is returning the IP...
1
by: laredotornado | last post by:
Hi, If I have multiple domains (mydomain1.com, mydomain2.com, mydomain3.com) pointing at the same IP, will the call echo $_SERVER{'SERVER_NAME']; return the domain name people type into the...
7
by: Hermann | last post by:
I run a server with apache 1.3 and php 5. Yesterday I notice that sometimes the HTTP_HOST server variable has a comma separated list in it. Let's say my domain name is: www.mydomain.com Usually...
7
by: JC | last post by:
Undefined index: HTTP_HOST This occurs sometimes, is there a reliable method for determining the HTTP_HOST. Not sure if this is something related to Apache or if it's a problem with the version...
2
by: klehonia | last post by:
Hi, i have a php server on iis6 win2003. When i write in index.php <? phpinfo(); ?> it brings me the information of php server _SERVER the name of localhost, but when i write the variable...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.