Apache: modifying localhost URL on HTTP request

Apache: modifying localhost URL on HTTP request

Post by Neil Zanell » Sat, 05 Jul 2003 10:29:32



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

 
 
 

Apache: modifying localhost URL on HTTP request

Post by Klaus Johannes Rusc » Sat, 05 Jul 2003 18:55:23



> 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

http://www.atmedia.net/KlausRusch/

 
 
 

Apache: modifying localhost URL on HTTP request

Post by Neil Zanel » Sun, 06 Jul 2003 02:19:36


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???

Thanks,

Neil



> > 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.

 
 
 

Apache: modifying localhost URL on HTTP request

Post by Joachim Ri » Sun, 06 Jul 2003 22:10:01


Quote:> 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

 
 
 

Apache: modifying localhost URL on HTTP request

Post by David Efflan » Mon, 07 Jul 2003 01:00:13



Quote:> 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???

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>



>> > 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.

--
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/
 
 
 

Apache: modifying localhost URL on HTTP request

Post by Neil Zanel » Mon, 07 Jul 2003 03:22:36



> > 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

 
 
 

Apache: modifying localhost URL on HTTP request

Post by David Efflan » Mon, 07 Jul 2003 07:43:03




>> > 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/

 
 
 

Apache: modifying localhost URL on HTTP request

Post by Neil Zanel » Mon, 07 Jul 2003 10:18:46



> 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



> >> > 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.

 
 
 

1. Apache Proxy server that will transform an HTTP request in a HTTPS request

Hello,

I'm looking for a software solution that can receive an HTTP request
and forwarding or proxying it in HTTPS.

For example : An application that makes https request but that can't
make https, will go through an Apache proxy that will encrypt the HTTP
request for the application and forward the request to the secure site
that will reply the same way.

 _____________              __________              ________
|             |            |          |            |        |
| Application | - HTTP --> | Apache   | - HTTPS -->| Secure |
|             |            | Proxy (?)|            | Site   |  
|_____________|            |__________|            |________|

IT's a bit like a SSL accelerator but working on the opposite way.

Is it possible with Apache ? How is it possible ? mod_ssl + mod_proxy
?

Thank you for your help.

Gilles.

2. Adaptec AVA-2825 suported?

3. rewrite rule for http URL -> https URL on specified directory

4. tty color problem

5. Apache problem: Can see http://localhost/ but not http://ipaddress/

6. Menu with 1) Win98, 2) WinNT, and 3) Linux - How?

7. proxy https & http request using apache

8. script Scheduler

9. Why request http://localhost/~woodsonli/index.html,but respond Forbidden?

10. redirecting HTTP-request to a second server based on a URL

11. apache seems to run fine but http://localhost tries to find it on the net instead

12. http://locahost/~johndoe/ VS. http://localhost/%7Ejohndoe/

13. [apache][ssl] https://localhost => error messages