Redirect server traffic locally


Recommended Posts

Hi,

 

  I have a website and I need to redirect traffic locally. e.g

 

Flow of packets

1. Godaddy domain mapping "mysite.com" should resolve to 10.5.5.5

 

2. But locally I need a mechanism where the traffic recieved from the godaddy redirect to 10.5.5.5 is directed locally to "http://10.5.5.5/myfolder/index.php". I also need a mechanism to direct it to 8080 port.

 

i.e traffic from say

godaddy1 to 10.5.5.5  -> http://10.5.5.5/myfolder1/index.php

godaddy2 to 10.5.5.5  -> http://10.5.5.5/myfolder2/index.php

godaddy3 to 10.5.5.5  -> http://10.5.5.5/myfolder3/index.php

 

Thanx!

Link to comment
Share on other sites

So is it mapped to that IP with DNS or is it redirecting to that IP?

When you say 'godaddy1/2/3', does that refer to 3 different domains or 3 .com/redirects?

Link to comment
Share on other sites

@ALL, my problem is on to transfer the traffic locally i.e without using external DNS. I need to point to a specific folder. All these folders in my example i.e myfolder1, myfolder2, myfolder3 are on 10.5.5.5 only and 8080 port is being used. But I need to be folder/directory specific as well.

i.e Traffic from Redirected from sites should land on different folder containing different web projects on the same IP.

Site1 to 10.5.5.5 -> http://10.5.5.5/myfolder1/index.php    ( i.e If people open redirecting url site1, then myfolder1 on 10.5.5.5 should be activated )

Site2 to 10.5.5.5 -> http://10.5.5.5/myfolder2/index.php    ( i.e If people open redirecting url site2, then myfolder2 on 10.5.5.5 should be activated )

Site3 to 10.5.5.5 -> http://10.5.5.5/myfolder3/index.php    ( i.e If people open redirecting url site3, then myfolder3 on 10.5.5.5 should be activated )

Site1,2,3 are redirecting sites.

 

10.5.5.5 has been used for example purpose only, it is class C IP only in reality and I can do port/IP redirect via IPTables, but I need to be folder specific as stated above.

Link to comment
Share on other sites

Well if your IP is visible from the net, and the 3 addresses are redirects only, then you should be able to set up the DNS on your domain host to redirect to each spesific folder.

Ie redirect www.ABC.com to 10.5.5.5/folder1/index.php

Redirect www.def.com to 10.5.5.5/folder/index.php

So on so forth.

Unless you want it to display as ABC.com/index.PHP, then I think you'd need 3 virtual servers mapped to each domain, but I could be wrong. A lot of it comes down to what web server you're using, IIS, Apache etc

Link to comment
Share on other sites

If you have your domains registered at GoDaddy.com then use the forward feature in your DNS manager at godaddy.com for each domain that you want to redirect the visitors to.

Link to comment
Share on other sites

@Sammy - I'm using Tomcat

@Riva - Thats a lot of homework. I need to read it thoroughly.

@Shozilla - Yes, Domain is registered at Godadyy, but I was wondering on how to do it locally.

Link to comment
Share on other sites

You could do this.

 

1. Run XAMPP (or another way to run Apache locally).

2. In hosts.etc, point all those domains to 127.0.0.1 (your own local IP).

3. Use Apache name-based virtual hosts to redirect each host to a different URL. Or use Apache as reverse proxy for it and you won't even see the difference between the real site and your local one.

 

It'll take a few minutes to figure it out but it's not that hard.

Link to comment
Share on other sites

Never really used tomcat but afaik it's just a JSP servlet program, therefore it's not possible. You'll need either a web server (IIS, apache, nginx, lighttpd, etc.) or a specialist load balancer piece of hardware/software

Link to comment
Share on other sites

n_K may have answer your question.  Tomcat is a JSP servlet.  I don't think it's a fully-fledge HTTP server even if it's functionality is somewhere close to it.  Like what he said, you need to run an HTTP server.  And he already listed them for ya.  I thought Tomcat was or used to be an email server of sort?  I too was thinking of doing this.  I am currently trying to set up an Apache server and currently have 2 DNS but only one IP.  Both of the WAN DNS is pointing to the same WAN IP and I think if I read your post correctly, you are attempting the same thing.  My objective is this.

 

www.myhomeserver.com    ->   24.25.125.225   ->   my Apache HTTP server 1   ->   D:/www-1

www.myveryownblog.com   ->   24.25.125.225   ->   my Apache HTTP server 1   ->   D:/www-2

www.mytestserver.com       ->   24.25.125.225   ->   my Apache HTTP server 1   ->   D:/www-3

 

Is this what you are attempting to do also?

Link to comment
Share on other sites

Can't edit but I think you probably need to run 3 HTTP servers.  Something like:

 

www.myhomeserver.com    ->   24.25.125.225   ->   my Apache HTTP server 1   ->   D:/www-1

www.myveryownblog.com   ->   24.25.125.225   ->   my Apache HTTP server 2   ->   D:/www-2

www.mytestserver.com       ->   24.25.125.225   ->   my Apache HTTP server 3   ->   D:/www-3

 

The IP is not real; well not mine anyways.  But I meant to demonstrate 1 IP pointing to 3 different DNS with either 3 different Apache servers or 1 same HTTP server with the mod_rewrite manipulation.

Link to comment
Share on other sites

@Shozilla - Yes, Domain is registered at Godadyy, but I was wondering on how to do it locally.

 

Put the IP address in the 'forward' address field in DNS Manager..

 

The visitors will be redirected to your local address, no problem. I have done mine and it has been fine since the day one.

Link to comment
Share on other sites

Ok first off DNS does not redirect to folders or ports.  It maps a fully qualified domain name (www.example.com) where www is the host and example.com is the domain to an IP.  Now you can use cnames to point www.example.com to host.otherdomain.tld for example..  But that is it..

 

if you have http://host.domain.tld and you want to direct it to http://otherhost.otherdomain.tld/something that is NOT done with dns, never was, never could be.  Now its possible dns providers provide that service - but its NOT done via dns - they listen for traffic at where host.domain.tld points and then send it where you want to go with a http redirect, etc.

 

You can have yourhost.yorudomain.tld that is registered with godaddy point to whatever IP you want that is reachable via the public net 10.x.x.x is private rfc1918 address space and is not useable on the internet - I can not tell if you are just using that as an example or if that is what you want.  If you want to use IPs for examples rfc5737 lists The blocks 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 for use in documentation.

 

As to running multiple servers?  You can provide as many sites as your http server can handle with just 1 instance in multiple ways.. You can have your server listen on multiple IPs that is assigned to the server, you can use different ports ie http://yourhost.yourdomain.tld:8080 you host headers or virtual domains where the http server knows that host.domain.tld gets served up from /folder1 on the server and host.ogtherdomain.tld gets served up from /folder2 or otherhost.domain.tld gets served up from /folder3

 

You can also use host.domain.tld/site1 host.domain.tld/site2 as ways to access sites off different web servers but you can direct to those with DNS.

 

If what you have is 3 different domains with godaddy, lets call them domain1.tld and domain2.tld and domain3.tld and you want people on the internet to go to your home public IP, then in dns point to your IP, or use dynamic dns service to auto change this IP if your isp connection changes, etc..  So

 

www.doman1.tld points to publicIP

www.domain2.tld points to publicIP

www.domain3.tld points to publicIP

 

Now on your router forward 80 to your webserver privateIP.  On your webserver be it what tomcat, then here is instructions on how to do virtual hosting on tomcat

http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

 

Google for tomcat virtual hosting - there are many guides and howto's

Link to comment
Share on other sites

And that is NOT DNS based -- its a REDIRECT via http..  Look up where the fqdn points too..

 

http://support.godaddy.com/help/article/422/forwarding-or-masking-your-domain-name

 

  1. Select your Redirect type
    • 301 (Permanent) ? Redirects to the site you specified in the Forward To field using a "301 Moved Permanently" HTTP response. The HTTP 301 response code tells user-agents (including search engines) that the location has permanently moved.
    • 302 (Temporary) ? Redirects to the site you specified in the Forward To field using a "302 Found" HTTP response. The HTTP 302 response code tells user-agents (including search engines) that the location has temporarily moved.

While they might have it in their "dns" section it is not a DNS protocol -- your hitting a web server they provide, and then it sends your browser a http redirect.

Link to comment
Share on other sites

And that is NOT DNS based -- its a REDIRECT via http..  Look up where the fqdn points too..

 

http://support.godaddy.com/help/article/422/forwarding-or-masking-your-domain-name

 

  1. Select your Redirect type
    • 301 (Permanent) ? Redirects to the site you specified in the Forward To field using a "301 Moved Permanently" HTTP response. The HTTP 301 response code tells user-agents (including search engines) that the location has permanently moved.
    • 302 (Temporary) ? Redirects to the site you specified in the Forward To field using a "302 Found" HTTP response. The HTTP 302 response code tells user-agents (including search engines) that the location has temporarily moved.

While they might have it in their "dns" section it is not a DNS protocol -- your hitting a web server they provide, and then it sends your browser a http redirect.

 

I know that!  but I was saying you can add it in the MANAGER  ... which the manager has the forward/redirect option in it. I didn't say dns based

Link to comment
Share on other sites

The OP clearly asked for DNS to do this is my point..

 

"1. Godaddy domain mapping "mysite.com" should resolve to 10.5.5.5"

 

If you ar going to recommend http redirect, then you should state that.  Nobody learns anything if you when he asked how to have dns redirect and you say "Put the IP address in the 'forward' address field in DNS Manager.."

 

And forwarding to an IP is going to cause him grief in serving up different pages if no host headers are sent by the browser.

 

While your method can be used - we should be clear to the OP and others that find this thread what is happening, and how to correctly do what they are asking vs work arounds like http redirects.

 

If I want to serve up 1000 sites off my http/tomcat server then I should point what ever fqdn (fully qualified domain name) I want to use to my IP..  Then have the server serve up the page based upon the fqdn that was asked..  Setting up redirects while a way to skin the cat is not really the optimal method of solving the problem. 

 

And I am still concerned that the OP thinks he can point public dns to a 10.x address and have it work ;)

Link to comment
Share on other sites

Ok first off DNS does not redirect to folders or ports.  It maps a fully qualified domain name (www.example.com) where www is the host and example.com is the domain to an IP.  Now you can use cnames to point www.example.com to host.otherdomain.tld for example..  But that is it..

 

if you have http://host.domain.tld and you want to direct it to http://otherhost.otherdomain.tld/something that is NOT done with dns, never was, never could be.  Now its possible dns providers provide that service - but its NOT done via dns - they listen for traffic at where host.domain.tld points and then send it where you want to go with a http redirect, etc.

 

You can have yourhost.yorudomain.tld that is registered with godaddy point to whatever IP you want that is reachable via the public net 10.x.x.x is private rfc1918 address space and is not useable on the internet - I can not tell if you are just using that as an example or if that is what you want.  If you want to use IPs for examples rfc5737 lists The blocks 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 for use in documentation.

 

As to running multiple servers?  You can provide as many sites as your http server can handle with just 1 instance in multiple ways.. You can have your server listen on multiple IPs that is assigned to the server, you can use different ports ie http://yourhost.yourdomain.tld:8080 you host headers or virtual domains where the http server knows that host.domain.tld gets served up from /folder1 on the server and host.ogtherdomain.tld gets served up from /folder2 or otherhost.domain.tld gets served up from /folder3

 

You can also use host.domain.tld/site1 host.domain.tld/site2 as ways to access sites off different web servers but you can direct to those with DNS.

 

If what you have is 3 different domains with godaddy, lets call them domain1.tld and domain2.tld and domain3.tld and you want people on the internet to go to your home public IP, then in dns point to your IP, or use dynamic dns service to auto change this IP if your isp connection changes, etc..  So

 

www.doman1.tld points to publicIP

www.domain2.tld points to publicIP

www.domain3.tld points to publicIP

 

Now on your router forward 80 to your webserver privateIP.  On your webserver be it what tomcat, then here is instructions on how to do virtual hosting on tomcat

http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

 

Google for tomcat virtual hosting - there are many guides and howto's

Ok first off, I don't believe I actually said anything about "DNS redirect to folders" or ports.  That is probably your interpretation of (my poor text-art maybe) what I was explaining.  I notice when I say something relating to Network, you seem to go off in a different path.  Let me clarify my points so that you don't try to beat me up so much.

 

ChangeIP.com offer a free DDNS service.  I am attempting to take advantage of their service to play with Apache HTTP server.  One, I get free DNS (domain name) for free.  Well it's not my DNS.  Don't nitpick this one :p  Don't jump on my throat yet.  Two, I do not need to point it to or do any manual "redirect" of my EXTERNAL IP for this service.  Because this is a DDNS and it's free.  Everything was done by the server once I add the free DNS in.

 

Scenario 1:

DDNS                                            Your IP                  Your server            Contents

budman.getthis.com          ->   123.45.67.89   ->   HTTP Server 1   ->   D : / www1

budman.ddns.us               ->   123.45.67.89    ->   HTTP Server 1   ->   E : / www2

angrybudman.ddns.com   ->   123.45.67.89    ->   HTTP Server 1   ->   F : / www3

 

Scenario 2:

budman.getthis.com          ->   123.45.67.89   ->   HTTP Server 1   ->   D : / www1

budman.ddns.us                ->   123.45.67.89   ->   HTTP Server 2   ->   E : / www2

angrybudman.ddns.com    ->   123.45.67.89   ->   HTTP Server 3   ->   F : / www3

 

Scenario 1 has only one instance of HTTP server redirecting three of the incoming web traffic to three different folders which contains different web content.  Hence the illusion of three different web server running.

 

Scenario 2 has three different HTTP servers.  Each HTTP server host its own web content.

 

My ONLY concern is on the server(s) AND contents.  I want to see three different web browser sees three different sites without the URL showing to one other DNS.  For example, if you visit "budman.getthis.com", your browser should see web content 1 while the URL still shows you are in "budman.getthis.com".  If you visit "budman.ddns.us", the browser URL still display "budman.ddns.us" while web content 2 shows up.  Another word, if you go to "angrybudman.ddns.com", it will not forward or show your new URL as "budman.getthis.com".

 

The real attempt here is three web sites on a single EXTERNAL IP (with three different contents of course).  That is the simplest I can say it.

 

Sorry original poster.  I just want to ask if this is what you were attempting to do.  But I think at this point, it looks like your thread has been highjacked lol...  I don't mean to.

 

Link to comment
Share on other sites

@krome no you didn't mention anything about dns redirect, who said my comments were directed at you?  But you clearly are confused if you think you need 3 different web servers to host 3 sites.

 

"either 3 different Apache servers or 1 same HTTP server with the mod_rewrite manipulation."

 

And no mod_rewrite is no what you or OP is talking about..  Mod rewrite would be used to rewrite a portion of url, not serve up a different site based upon the headers sent to the http server.

 

How are you going to send the same IP to different web servers in your 2nd scenario - this would be a load balancer or reverse proxy.  That looks at the headers your asking for say angrybudman.ddns.com and knows to send to http server 3 at some other IP than the the IP your A record points to for angrybudman.ddns.com

 

And your scenario one is just simple host headers or virtual hosting depending on what http server your using they can be called either.

 

And nobody is jumping on any throats ;)  It is a simple discussion of different protocols and technologies to serve up multiple names off the same server for http.

Link to comment
Share on other sites

From what I got out of reading this (while its confusing exactly what he is asking) 

 

I think theres an easier way to do it...

 

 

I'm more familiar with Windows Server, IIS and Windows DNS, but if he has a local network and DNS server, he theoretically wouldn't even need to register with GoDaddy if he only wants it accessible within his local network. Just setup a DNS server with Forward Lookup Zone and have the clients point to that DNS server.

 

Use sub-domains.... as what others have mentioned above... would be a lot easier and probably what you're looking for, with IIS, you can create subdomains that point to different folders (binding)...

 

Whether or not that is what he is asking isn't exactly clear... with IIS, a website only responds to its bindings... I.E sub1.domain.com with ip 10.5.5.5 will only respond to requests when that is entered in a web browser... 

 

To clearify....

 

IIS Config:

 

site1 > binding = sub1.domain.com = IP 10.5.5.5 > Folder = /folder1/index.html

site2 > binding = sub2.domain.com = IP 10.5.5.5 > Folder = /folder2/index.html

 

If I type sub1.domain.com it will gather the contents from ONLY /folder1/ 

If I type sub2.domain.com it will gather contents from ONLY /folder2/

 

 

 

 

 

I apologize if I am ignorant to what he is REALLY searching for, but its just my two cents without more information.

Link to comment
Share on other sites

"But you clearly are confused if you think you need 3 different web servers to host 3 sites."

Well, I thought single web server on a single instance require a lot of complicated steps to set up, to serve 3 different contents.  That's why I do the most obvious easiest way (less complicated?) I could think of.  Using three different HTTP instances hosting different web site contents require lessor complicated steps I think.  But the original poster wasn't exactly clear on his intention to which I am confused.

"Mod rewrite would be used to rewrite a portion of url, not serve up a different site based upon the headers sent to the http server."

Yes.  I would never think differently than that.  Don't you insinuate that I mean using mod_rewrite to replace a DNS server?  :p

 

"How are you going to send the same IP to different web servers in your 2nd scenario - this would be a load balancer or reverse proxy.  That looks at the headers your asking for say angrybudman.ddns.com and knows to send to http server 3 at some other IP than the the IP your A record points to for angrybudman.ddns.com"

A response to the first sentence.  With the free DDNS service, the server handle its own DNS record.

A response to the second sentence.  I think you are on the right track on this.  Since I do not have full control of the DNS record, I don't think I parse the header request from the EXTERNAL DNS server, can I?  Yeah I am not sure about this yet.  I would have to test this and get back to you on that.

 

Yeah.  In short, the "virtual host" or sub-domain (header) request was sent from WWW user agent to DNS server and then it direct the traffic to my only one IP which the original header is already parsed and yeah I would not get the original header request.  If that is where you are getting at, yes I do not have an answer yet.  Only conjecture.  Unless you have a clear-cut version of how this is accomplished, you let me know.  I was just asking the original poster to see if he was attempting something like that.  And by that I mean using three domain on a single server to spit out three different contents.

 

At this point I think prefer to have the original poster clarify his intention one more time.  Kinda confusing for me to try to backtracking :p  Yeah I am confused. :p

Link to comment
Share on other sites

You can't setup and have 3 web servers on a single PC for what was asked because of port conflict, only ONE service can use port 80, if you wanted different web servers then you'd need multiple ports which would look awful.

Link to comment
Share on other sites

While true you can not have them all listen on port 80 on the same IP.. You can just give the box more than 1 IP and have the different IPs listen on 80..

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.