Jump to content



Photo

Redirect server traffic locally


  • Please log in to reply
34 replies to this topic

#1 mediator

mediator

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 22-January 07

Posted 29 March 2014 - 12:07

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!




#2 Ambroos

Ambroos

    Neowinian Senior

  • Tech Issues Solved: 6
  • Joined: 16-January 06
  • Location: Belgium
  • OS: Windows 7 + 8.1
  • Phone: Sony Xperia Z2

Posted 29 March 2014 - 12:37

Locally as in on your PC only or on a private network?



#3 Sammyinnit

Sammyinnit

    Neowinian

  • Joined: 14-October 04
  • Location: England.
  • OS: Windows 7 x64
  • Phone: HTC EVO 3D/Google-Asus Nexus 7 2nd Gen Tablet

Posted 29 March 2014 - 13:41

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?

#4 OP mediator

mediator

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 22-January 07

Posted 29 March 2014 - 22:16

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



#5 Sammyinnit

Sammyinnit

    Neowinian

  • Joined: 14-October 04
  • Location: England.
  • OS: Windows 7 x64
  • Phone: HTC EVO 3D/Google-Asus Nexus 7 2nd Gen Tablet

Posted 29 March 2014 - 23:18

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

#6 Riva

Riva

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 11-February 07

Posted 29 March 2014 - 23:29

Sounds like you need URL rewritting. Can be achieved with an enterprise firewall or reverse proxy. or look at this guide http://httpd.apache....writeguide.html



#7 shozilla

shozilla

    Neowinian Senior

  • Tech Issues Solved: 6
  • Joined: 11-January 09

Posted 29 March 2014 - 23:42

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.



#8 OP mediator

mediator

    Neowinian

  • Tech Issues Solved: 1
  • Joined: 22-January 07

Posted 30 March 2014 - 08:51

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



#9 Ambroos

Ambroos

    Neowinian Senior

  • Tech Issues Solved: 6
  • Joined: 16-January 06
  • Location: Belgium
  • OS: Windows 7 + 8.1
  • Phone: Sony Xperia Z2

Posted 30 March 2014 - 10:50

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.



#10 n_K

n_K

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 19-March 06
  • Location: here.
  • OS: FreeDOS
  • Phone: Nokia 3315

Posted 30 March 2014 - 11:02

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



#11 Krome

Krome

    Neowinian God!

  • Joined: 29-August 01

Posted 30 March 2014 - 11:46

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?



#12 Krome

Krome

    Neowinian God!

  • Joined: 29-August 01

Posted 30 March 2014 - 11:51

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.



#13 shozilla

shozilla

    Neowinian Senior

  • Tech Issues Solved: 6
  • Joined: 11-January 09

Posted 30 March 2014 - 12:35

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



#14 +BudMan

BudMan

    Neowinian Senior

  • Tech Issues Solved: 86
  • Joined: 04-July 02
  • Location: Schaumburg, IL
  • OS: Win7, Vista, 2k3, 2k8, XP, Linux, FreeBSD, OSX, etc. etc.

Posted 30 March 2014 - 12:46

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.oth...n.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...ting-howto.html

 

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



#15 shozilla

shozilla

    Neowinian Senior

  • Tech Issues Solved: 6
  • Joined: 11-January 09

Posted 30 March 2014 - 13:18

Budman,

 

You can add the local address in GoDaddy's DNS manager, no problem...

 

for example:  mydomain.com forward to http://222.222.222.2...h/to/index.html

 

Then once the update is cleared, visitors will be able to visit the local address from the domain.

 

Masking is optional... which you can hide the IP address if you want to.