httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CJ <unix1...@yahoo.com>
Subject RE: [users@httpd] need help with ip addr not resolving to www name.
Date Thu, 23 Oct 2003 11:21:10 GMT
Thank you all for the good information. 
 
I will try setting up virtual hosts and let you know
how it goes. I do not have any defined at this time
and after reading all the responses it seems I need at
least 2 of them to get the redirect to work right. 
 
I thought the ServerName took care of this based on
the  e comments int eh file. I learn something new
every day. 
 
I'll write back and let you know how it goes shortly. 




Boyle Owen <Owen.Boyle@swx.com> wrote:
Plain text please...

I think you might be misunderstanding the function of
the ServerName
directive. It is used by apache to match INCOMING
requests to the
appropriate virtual host. It is not "returned" to the
client...

Assuming http, a URL consists of two parts: 

http://host/localinfo

- The "host" can be a fully-qualified domain name,
like www.amazon.com,
a machine name on the local network, or a bare IP
address. It may or may
not include a port number - if it doesn't, port 80 is
assumed. In any
case, it must resolve to an IP address.
- The "localinfo" is the path to the file you want
from the DocumentRoot
of the VH defined by the "host".

If your link contains an IP address as the Host, then
when the request
arrives at apache, it will have no "host" information.
If you have
several name-based VHs, apache will not be able to
match it to any
particular one and so will serve the first VH by
default. If you have
only one VH, it will serve that one. Note that apache
just serves files
- it doesn't tell the client anything about the VH
configuration...

However, the way to get things to work the way you
want is to set up
name-based virtual hosting with two VHs. One is your
"real" VH with the
"real" ServerName and the other, which must come
first, is a dummy VH
with a fake ServerName. The dummy VH then redirects
all traffic to the
real VH. E.g.

NameVirtualHost *

# Fake VH to trap host-less requests

ServerName dummy-fake
Redirect / http://www.your-server.com/


# Real VH

ServerName www.your-server.com
DocumentRoot /path/to/real/site
...etc.

So what happens is:

- request comes in with no host header
- doesn't match VH1 (servername = dummy-fake)
- doesn't match VH2 (servername = www.your-server.com)
- so apache serves VH1 by default
- VH1 says, redirect to www.your-server.com
- apache sends 301 Redirect to the browser
- browser receives the redirect and changes display to
read
www.your-server.com
- new request comes in WITH host header =
www.your-server.com
- doesn't match VH1 (servername = dummy-fake)
- matches VH2 so browser gets that data.

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message
may be ignored. 

-----Original Message-----
From: CJ [mailto:unix1adm@yahoo.com]
Sent: Donnerstag, 23. Oktober 2003 02:21
To: users@httpd.apache.org
Subject: [users@httpd] need help with ip addr not
resolving to www name.


How can I get apache to not return the IP address of
my server. 

I have links that go to an address of 

http://123.123.123.123/index.html but when you click
on the link in the
browser address it shows the ip addr not the domain
name. I have defined
the server in the httpd.conf file to be ServerName
www.mydomain.com but
it still show the IP addr. Stopped and restarted the
apache server etc. 

The environment is such that the initial page is
hosted on a 3rd party
www server and it has links back to the real server.
The links work fine
just the IP addr is the problem. 


There are two major products to come out of Berkeley:
LSD and
UNIX. We don't believe this to be a coincidence.
Blessed are the pessimists, for they make backups!
Tell me and I forget. Show me and I remember. Involve
me and I learn."
10101010011100101001001000011010000001000100101010101010
0011001010100010110010101000010001010000


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
Diese E-mail ist eine private und persönliche
Kommunikation. Sie hat
keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der
SWX Swiss Exchange.
This e-mail is of a private and personal nature. It is
not related to
the exchange or business activities of the SWX Swiss
Exchange. Le
présent e-mail est un message privé et personnel, sans
rapport avec
l'activité boursière de la SWX Swiss Exchange.

This message is for the named person's use only. It
may contain
confidential, proprietary or legally privileged
information. No
confidentiality or privilege is waived or lost by any
mistransmission.
If you receive this message in error, please notify
the sender urgently
and then immediately delete the message and any copies
of it from your
system. Please also immediately destroy any hardcopies
of the message.
You must not, directly or indirectly, use, disclose,
distribute, print,
or copy any part of this message if you are not the
intended recipient.
The sender's company reserves the right to monitor all
e-mail
communications through their networks. Any views
expressed in this
message are those of the individual sender, except
where the message
states otherwise and the sender is authorised to state
them to be the
views of the sender's company. 



---------------------------------------------------------------------
The official User-To-User support forum of the Apache
HTTP Server Project.
See for more info.
To unsubscribe, e-mail:
users-unsubscribe@httpd.apache.org
" from the digest:
users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail:
users-help@httpd.apache.org


=====
There are two major products to come out of Berkeley: LSD and
UNIX. We don't believe this to be a coincidence.
Blessed are the pessimists, for they make backups!
Tell me and I forget. Show me and I remember. Involve me and I learn."
10101010011100101001001000011010000001000100101010101010
0011001010100010110010101000010001010000

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message