Apache: modifying localhost URL on HTTP request

This is a discussion on Apache: modifying localhost URL on HTTP request within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hello, Suppose some webmaster was writing a web page and previewing it at http://localhost/foobar. The webmaster has an ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-04-2003
Neil Zanella
 
Posts: n/a
Default Apache: modifying localhost URL on HTTP request


Hello,

Suppose some webmaster was writing a web page and previewing it at
http://localhost/foobar. The webmaster has an IP address which changes
quite often. The webmaster would like the URL to change in mozilla from
http://localhost/foobar to http://w.x.y.z/foobar where w.x.y.z is the
IP address of the page. This way, when the webmaster clicks on the W3
validator button (as shown below), the W3C server does not give a 404
error of "host localhost not found". At the same time, the webmaster
does not have to run ipconfig to get the IP address and can simply
keep using localhost in the URL. As the page is loaded, the
localhost in the URL changes to w.x.y.z. Is this possible
with apache?

<p>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
</p>


Thanks!!!

Neil

  #2 (permalink)  
Old 07-04-2003
Klaus Johannes Rusch
 
Posts: n/a
Default Re: Apache: modifying localhost URL on HTTP request

Neil Zanella wrote:

> Suppose some webmaster was writing a web page and previewing it at
> http://localhost/foobar. The webmaster has an IP address which changes
> quite often. The webmaster would like the URL to change in mozilla from
> http://localhost/foobar to http://w.x.y.z/foobar where w.x.y.z is the
> IP address of the page. This way, when the webmaster clicks on the W3
> validator button (as shown below), the W3C server does not give a 404
> error of "host localhost not found". At the same time, the webmaster
> does not have to run ipconfig to get the IP address and can simply
> keep using localhost in the URL. As the page is loaded, the
> localhost in the URL changes to w.x.y.z. Is this possible
> with apache?


You need a nameserver to point to your machine (and your machine must be
reachable from the Internet). If you have a dynamic IP address that changes
frequently, look at one of the Dynamic DNS services (such as dyndns.org).
This has nothing to do with Apache.

--
Klaus Johannes Rusch
KlausRusch@atmedia.net
http://www.atmedia.net/KlausRusch/


  #3 (permalink)  
Old 07-05-2003
Joachim Ring
 
Posts: n/a
Default Re: Apache: modifying localhost URL on HTTP request

> I do have a fully qualified domain name (FQDN) and a corresponding IP address,
> so I do not need any other domain name services. What I want though, is that
> when users type http://localhost/ into their web browser, from the host
> computer, the URL changes in the web browser's URL text label to either the FQDN
> or the actual IP, automatically. Why coulnd't Apache do this? I am thinking that
> it could be done with URL redirection? How???


if you've a correct ServerName entry on each developer machine in
httpd.conf you might try UseCanonicalNames On which should make apache
send a redirect to the http://ServerName/path for each request to
localhost...

joachim
  #4 (permalink)  
Old 07-05-2003
Neil Zanella
 
Posts: n/a
Default Re: Apache: modifying localhost URL on HTTP request

jring@web.de (Joachim Ring) wrote in message news:<3ae246c1.0307050510.26252836@posting.google. com>...
> > I do have a fully qualified domain name (FQDN) and a corresponding IP address,
> > so I do not need any other domain name services. What I want though, is that
> > when users type http://localhost/ into their web browser, from the host
> > computer, the URL changes in the web browser's URL text label to either the FQDN
> > or the actual IP, automatically. Why coulnd't Apache do this? I am thinking that
> > it could be done with URL redirection? How???

>
> if you've a correct ServerName entry on each developer machine in
> httpd.conf you might try UseCanonicalNames On which should make apache
> send a redirect to the http://ServerName/path for each request to
> localhost...
>
> joachim


Thank you for your response. However setting the UseCanonicalName to On and
then using a ServerName directive to specify the host and port to display
in the browser's URL text field is not such a good idea because the FQDN
of my computer changes every now and then, together with its IP. But
I wonder why Apache can't figure the FQDN out without having to
specify if in the ServerName directive. After all tools like
ipconfig and nskookup can do this. The FQDN could be
obtained when apache is started and cached, couldn't
it?

Thanks,

Neil
  #5 (permalink)  
Old 07-05-2003
David Efflandt
 
Posts: n/a
Default Re: Apache: modifying localhost URL on HTTP request

On 5 Jul 2003 11:22:36 -0700, Neil Zanella <nzanella@cs.mun.ca> wrote:
> jring@web.de (Joachim Ring) wrote in message news:<3ae246c1.0307050510.26252836@posting.google. com>...
>> > I do have a fully qualified domain name (FQDN) and a corresponding IP address,
>> > so I do not need any other domain name services. What I want though, is that
>> > when users type http://localhost/ into their web browser, from the host
>> > computer, the URL changes in the web browser's URL text label to either the FQDN
>> > or the actual IP, automatically. Why coulnd't Apache do this? I am thinking that
>> > it could be done with URL redirection? How???

>>
>> if you've a correct ServerName entry on each developer machine in
>> httpd.conf you might try UseCanonicalNames On which should make apache
>> send a redirect to the http://ServerName/path for each request to
>> localhost...
>>
>> joachim

>
> Thank you for your response. However setting the UseCanonicalName to On and
> then using a ServerName directive to specify the host and port to display
> in the browser's URL text field is not such a good idea because the FQDN
> of my computer changes every now and then, together with its IP. But
> I wonder why Apache can't figure the FQDN out without having to
> specify if in the ServerName directive. After all tools like
> ipconfig and nskookup can do this. The FQDN could be
> obtained when apache is started and cached, couldn't
> it?


The UseCanonicalName On would not solve the problem because that would
only work if something (relative redirect from script or incomplete URL)
triggered a redirection. And now you tell us your FQDN hostname changes
too. How would you expect anyone from the internet to reliably access
you?

Apache does not check your FQDN, because in most cases it does not even
care which interface a request comes in on, unless you configure it to
bind to specific IP(s) and/or port(s), or virtual host.

If you want this to work, maybe you should consider getting a fixed FQDN
from a dynamic DNS service (I use free no-ip.com names). Then if you run
their client to keep the DNS up to date, a fixed name will always point to
your dynamic public IP. And if you cannot figure out how to redirect, you
could put a shortcut to that name in your browser.

Otherwise, you are going to have to do some scripting to modify apache's
config and restart it.

--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
  #6 (permalink)  
Old 07-06-2003
Neil Zanella
 
Posts: n/a
Default Re: Apache: modifying localhost URL on HTTP request

efflandt@xnet.com (David Efflandt) wrote in message news:<slrnbgdtgc.ofn.efflandt@typhoon.xnet.com>...

> In order to redirect to a dynamic IP, you would need to know the IP to
> configure it. But redirecting localhost to a dynamic DNS name should be
> easy using an IP based vhost (works best if ServerName is set to public
> name):
>
> <VirtualHost 127.0.0.1>
> Redirect / http://your.name.here/
> </VirtualHost>


Doesn't this redirect localhost to the _static_ name http://your.name.here/?
Given that the DNS name is dynamic (it changes with the IP address), doesn't
that mean that the http://your.name.here/ inside the configuration file
would have to be changed each time a new fully qualified domain name is
assigned to the computer? Otherwise the http://your.name.here/ entry
would become outdated. Perhaps I missed something?

Thanks,

Best Regards,

Neil

> > Klaus Johannes Rusch <KlausRusch@atmedia.net> wrote in message news:<3F054F0B.8248833C@atmedia.net>...
> >> Neil Zanella wrote:
> >>
> >> > Suppose some webmaster was writing a web page and previewing it at
> >> > http://localhost/foobar. The webmaster has an IP address which changes
> >> > quite often. The webmaster would like the URL to change in mozilla from
> >> > http://localhost/foobar to http://w.x.y.z/foobar where w.x.y.z is the
> >> > IP address of the page. This way, when the webmaster clicks on the W3
> >> > validator button (as shown below), the W3C server does not give a 404
> >> > error of "host localhost not found". At the same time, the webmaster
> >> > does not have to run ipconfig to get the IP address and can simply
> >> > keep using localhost in the URL. As the page is loaded, the
> >> > localhost in the URL changes to w.x.y.z. Is this possible
> >> > with apache?
> >>
> >> You need a nameserver to point to your machine (and your machine must be
> >> reachable from the Internet). If you have a dynamic IP address that changes
> >> frequently, look at one of the Dynamic DNS services (such as dyndns.org).
> >> This has nothing to do with Apache.

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:42 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0