How to forward traffic to another dns by port - networking

In order for my app to work for example, it needs to communicate with 3 different url:port. Lets say:
host1.com:1111
host2.com:1234
host3.com:1234
(Same port for 2 hosts)
What i want is to use a single url, and the route will be betterment by the port:
fathost.com:1111 --> host1.com:1111
fathost.com:2222 --> host2.com:1234
fathost.com:3333 --> host3.com:1234
(Port 2222 is redirected to 1234 on host2,
Port 3333 is redirected to 1234 on host3)
Keep in mind that the app is run on a clients machine, so changing iptables is not possible.
Tried a loadbalancer but it can only return a redirect (status code 302,301) and i need it to transfer the request.
Tried solve it with Dns records (srv), but no luck
Any ideas? (Cloud services also a possible option)
Thanks for the help
UPDATE:
Because the app is run on a clients machine, Im asking the client to allow traffic from all 3 hosts (host1, host2, host3), what I want is to only allow traffic from 1 host fasthost.com (that will probably will have a static ip)

Related

Nginx multiple subdomains in local network

So this is a common question but with a twist that I have a hard time solving. I want to have multiple apps in a server (a raspberry pi to be exact) in my local network. Not connected to the internet. I don't have and don't want a domain name, however I have set up my router DNS to point from home to the server local IP. All of this works fine and I can access an HTTP server at http://home.
I want to be able to do:
app1.home -> proxy to app1 in 3000
app2.home -> proxy to app2 in 3001
and so on.
I have tried to create one server for each app. If I set server_name to app1.home (for example) it does not work.
I'm kinda lost, I have only set up basic Nginx servers and this is my first complicated one. How should I approach this?

How get rid of Port number followed by domain name like www.domainname.com:49200 instead if we type www.domainname.com in browser without port number

i am trying to Host the asp.net and silverlight application in IIS(Internet Information Service) using 49200 Port instead of Default HTTP port 80.
When i am trying to browse the application With domain name www.domainname.com it is showing not connected. When i tried it for www.domainname.com:49200 application successfully browsing. How to get rid of port number 49200 Without typing port number www.domainname.com application should browse. Please Help me How to achieve this one in IIS.
Thanks in advance experts!.
When you type www.hostname.com, the assumed port is 80. therefore, www.hostname.com is the same as typing www.hostname.com:80.
If you want to get rid of the 49200 on the end, you will need to do one of two things:
Change your site in IIS to be hosted on port 80 instead of port 49200
Introduce another server or a load balancer which is listening on port 80 and is rerouting the traffic to port 49200 on the other server.

Multiple Web Applications - Same VM vs Multiple VMs

Firstly, I am more of a dev than admin. And I have always asked questions here. But please let me know if there is a better place to ask this question.
Here's my situation. I have an application that is built to run on linux. It serves both https (on port 443 using nginx) and ssh (on port 22). But due to organizational restrictions, I am forced to run it on a windows host with a linux guest using virtual box. Also, there is another web application on the host box; both these web applications should be served based on the URL (example: app1.com, app2.com). URLs need to be preserved. All ssh traffic can default to guest.
One idea I have to make this work is below, and I would like to know
if I am making this more complicated than it should be. Any help is appreciated.
Steps:
Use an unused port for https (say 8443) on my host and redirect all
traffic to the guest. Use NAT based port forwarding (8443 -> 443, 22 -> 22)
in Virtualbox.
The only thing left would be to setup another nginx on
the host as a reverse proxy. Set up virtual hosts on windows
(/etc/hosts) and have the two IP and URL entries (app1.com and app2.com).
Use a separate nginx on the host as a reverse proxy to redirect app1 traffic
to the web app on the host and app2 traffic to 8443.
Questions:
Can I avoid the extra nginx reverse proxy on the host while preserving the URL?
Also what about ssl. Can I just set up https on the host and route it to port 80 on guest and avoid having two certs? Note: I am using NAT in Virtualbox, so there should not be any security issues I guess.
This is an administration question, and the user posted the identical question to serverfault, where it was answered: https://serverfault.com/questions/835220/multiple-web-applications-same-vm-vs-multiple-vms

Access Web Site W/O Including Port

I have a Asp.net website hosted through Ultidev, and am using DynDns to assign a hostname (web address) to the site. My question is, is their a setting or configuration or something that I can change to go to www.yoursitename.org and my page load? Or must you always specify the port to connect to in order to connect to your site www.yoursitename.org:12345
Assuming you have already configured your router to forward port 80 (standard http port) traffic to you host computer, and opened PC firewall to allow inbound port 80 connections, then what you need to do is to run "[UltiDev Web Server Explorer][1]" and there add combination of the www.yoursitename.org and port 80 as shown on the screenshots below. One thing to note that if port 80 is already occupied in the exclusive mode by an another web server (Apache, etc.), you will see that when saving UWS configuration, the www.yoursitename.org:80 will disappear. If it didn't disappear, then the site:port combination was available and now will be used.

Setting up a SRV record to redirect from subdomain to main domain but different port

So this is my desired result.
I have a VPS (hosted at DigitalOcean) that has two servers running. One is a webserver listening on port 80 that can be accessed simply by typing my domain name like myfirefly.me
The other server is also a webserver but listening on port 8442. It can be accessed like myfirefly.me:8442.
What I want is to be able to access it like elopakao.myfirefly.me.
If I understood my google results correctly, the easiest way to do this is using SRV records. DigitalOcean provides support for them but I'm having trouble understanding what I need to type in each of the fields. This is my current setup:
_sip._tcp.myfirefly.me. IN SRV 0 5 8442 elopakao.myfirefly.me.
where myfirefly.me is my domain and elopakao is the desired subdomain.
Apparently the setting has propagated but when I type in elopakao.myfirefly.me I don't get anything.
What I'm assuming is happening is that elopakao.myfirefly.me is being routed to elopakao.myfirefly.me:8442 instead of myfirefly.me:8442
How can I make this work?

Resources