Different Web Page for different client IP address?

Different Web Page for different client IP address?

Post by Mike Berry-Porte » Fri, 06 Sep 1996 04:00:00



Hi. Have a question regarding Apache/Httpd web page servers. I want to
have a way of giving people different web pages who are part of
different networks. ie. I want to give our local subnet (class c) users
access to one such directory eg. "in-house web service" but anyone else
(the rest of the Internet) will get a totally different webpage
directory.

Can this be done?!

Is it a feature of Apache/httpd, or is it something I need to look at
from the network layer. (tcpwrap?) If so how? Or if none of these are
possible, is it possible to "redirect" outside packets to another
address, even though they were attempting to access the inside?

I a little lost as to where I should head regarding this, so any help
ata all would be greatly appreciated.
Thanks
Mike Berry-Porter

 
 
 

Different Web Page for different client IP address?

Post by Richard Sto » Fri, 06 Sep 1996 04:00:00


On Thu, 05 Sep 1996 12:54:14 -0700, Mike Berry-Porter


>Hi. Have a question regarding Apache/Httpd web page servers. I want to
>have a way of giving people different web pages who are part of
>different networks. ie. I want to give our local subnet (class c) users
>access to one such directory eg. "in-house web service" but anyone else
>(the rest of the Internet) will get a totally different webpage
>directory.

>Can this be done?!

Yes.  Easily.

Quote:>Is it a feature of Apache/httpd, or is it something I need to look at
>from the network layer. (tcpwrap?) If so how? Or if none of these are
>possible, is it possible to "redirect" outside packets to another
>address, even though they were attempting to access the inside?

It is a feature of HTTP 1.1, supported by the latest release of Apache.
Look it up in the docs under "virtual host".

Quote:>I a little lost as to where I should head regarding this, so any help
>ata all would be greatly appreciated.

Basically, you can assign multiple host/domain names to a single IP
address, register them with your DNS, and have Apache display different
pages depending on which address is attempted.  Same for multiple IP
addresses which point to a single physical host.  The concept is a "virtual
host" or "virtual server".  What you propose (ie, a different IP accessed
depending on whether one is accessing from the intranet or the internet) is
readily and quickly supported.  You can also individually configure access
for each virtual server, to deny access from outside your intranet to the
internal site, and (if necessary) vice versa.

Multiple virtual hosts on a single IP requires HTTP 1.1 (latest Apache
(1.1?), and HTTP 1.1 compatible browsers (Netscape 1.1 is too early, 1.22
may be OK, 2.0+ is definitely OK).

Multiple virtual hosts on different IPs works with Apache 1.0+ and HTTP
1.0+ compatible browsers (basically everything).

 
 
 

Different Web Page for different client IP address?

Post by Mike Berry-Porte » Fri, 06 Sep 1996 04:00:00


I think I should've added the following to my original post:

I've (after much hassle) have got a "dummy" interface configured on a
machine, which only has one ethernet card. Now the machine has two IP
addresses; x.x.x.13 is the REAL/ETHERNET card address, and x.x.x.14 is
the dummy address. Yes, I have it such that if you try to connect to
x.x.x.13 you get one set of documents, and if you connect to x.x.x.14
you get another. OK, fine up to here...

What I want to do is sort of like the opposite. Say, for example, my
internal network is part of class C network 10.0.1.0 mask 255.255.255.0,
and we have a router to the internet that has everyother possible IP
address range. What I would like to have happen is this: If I try to
connect to 10.0.1.13, I want to get an in-house set of web pages, but if
anyone OUTSIDE of 10.0.1.0 network tries to access the same page ie.
10.0.1.13, I want them to get an outsider's set of web pages. Does that
make sense?

Again, any help would be greatly appreciated. Thanks.
Mike Berry-Porter

 
 
 

Different Web Page for different client IP address?

Post by Yat Si » Sat, 07 Sep 1996 04:00:00


Quote:> What I want to do is sort of like the opposite. Say, for example, my
> internal network is part of class C network 10.0.1.0 mask 255.255.255.0,
> and we have a router to the internet that has everyother possible IP
> address range. What I would like to have happen is this: If I try to
> connect to 10.0.1.13, I want to get an in-house set of web pages, but if
> anyone OUTSIDE of 10.0.1.0 network tries to access the same page ie.
> 10.0.1.13, I want them to get an outsider's set of web pages. Does that
> make sense?

Let me recap this, from what I can see is that you want people from
10.0.1.0 network to see document A when they contact 10.0.1.13, and
when people from outside contact 10.0.1.13 they receive document B
WITHOUT using virtual hosting?

If I may ask....

WHY?

If I misunderstood, sorry about that.

As to a possible solution (other than that it doesn't make much sense)
is that you could infact write a little redirection program, in
other words using cgi-bin for instance. It would read the ip address
of your server and then relocate it to another set of files.

Perhaps another option is to set up a firewall, so that the 10.0.1.13
ip for the internal network is infact fake, but redirects to  another
document anyways and the 10.0.1.13 is real, and directs to the
original, but how that would be possible on the *same* machine
could be a trifle mindboggling.

Cheers

Yat

> Again, any help would be greatly appreciated. Thanks.
> Mike Berry-Porter


 
 
 

Different Web Page for different client IP address?

Post by Yat Si » Sat, 07 Sep 1996 04:00:00



> Hi. Have a question regarding Apache/Httpd web page servers. I want to
> have a way of giving people different web pages who are part of
> different networks. ie. I want to give our local subnet (class c) users
> access to one such directory eg. "in-house web service" but anyone else
> (the rest of the Internet) will get a totally different webpage
> directory.

Mike,

most people use password authentication for in-house web services,
to do what you want to do looks like too much work to justify the
effort if that's all you need for in-house web service.

Cheers

Yat

 
 
 

Different Web Page for different client IP address?

Post by Ingo Luetkebohl » Sat, 07 Sep 1996 04:00:00



> What I want to do is sort of like the opposite. Say, for example, my
> internal network is part of class C network 10.0.1.0 mask 255.255.255.0,
> and we have a router to the internet that has everyother possible IP
> address range. What I would like to have happen is this: If I try to
> connect to 10.0.1.13, I want to get an in-house set of web pages, but if
> anyone OUTSIDE of 10.0.1.0 network tries to access the same page ie.
> 10.0.1.13, I want them to get an outsider's set of web pages. Does that
> make sense?

You could write a CGI the checks REMOTE_ADDR and returns an appropriate
redirect based on the IP. For example, a small PERL script:
--- cut here ---
$INSIDE_PAGE = "http://www.veryComputer.com/;;
$OUTSIDE_PAGE = "http://www.veryComputer.com/;;

print
        "HTTP/1.0 304 REDIRECT\r\n",
        "Location: ";

if( $ENV{'REMOTE_ADDR'} =~ /your.net.here./o ) {
        print $INSIDE_PAGE;

Quote:} else {

        print $OUTSIDE_PAGE;

Quote:}

print "\r\n\r\n";
--- cut here

Thats no real access checking (you'd have to do that seperately) but it
gets the work done. The PERL source above is probably syntactically
incorrect (I just typed it in right now) but it should give you the
idea. Hope it helps.

//Ingo

"There's too much * in my caffeeine-stream"

 
 
 

1. Q: Different web pages for Different browsers?



Yes, generally. Unfortunately, I've noticed that while pages with tables
usually look great in the latest Lynx, the version of MSIE distributed with
Windows95 makes them look absolutely horrible.

Adding <BR>'s at the end of each <TR></TR> causes too much extra whitespace.
--
David Richards                             Ripco, since Nineteen-Eighty-Three
My opinions are my own,                    Public Access in Chicago
But they are available for rental          Shell/SLIP/PPP/UUCP/ISDN/Leased

2. p2p servers outside the firewall

3. OnDemand ijppp: different phone numbers for different ip addresses

4. Documentation for FBSD 4.8

5. requiring different users based at different IP addresses?

6. Decimals in ksh

7. Alternative Web-Pages for different IP′s

8. Configuring X for MACH64 card and Nokia 447x Monitor

9. Display different home page based on IP address?

10. How can I show a different home page based on IP address ?

11. Different Page Based On Incoming IP Address/Host

12. Different page depending on ip address