How to make when entering the domen1.tld:8080, was given to the content domen2.tld:8080?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
The problem is, you need to make it so that when the browser requested addresses, for example domen1.tld:8080 was given that is on a different physical computer/address, for example domen2.tld:8080.


— 2 computers (both routers and OS Debian);

— the first IP to static, the second dynamic;

— domain name (domen1.tld), which is linked to the first server (it is fundamental and should be linked to the first server, in this embodiment, binding it to the second server, or move the service from the second computer to the first offer) and the second domain name (domen2.tld) is dynamically updated by the second computer;

on a second computer running a server from the primary domain, or rather the subdomain is registered as SRV and CNAME records.

Need some way to make it so that when you connect to the main root domain — domen1.tld port 8080, connect went to the second computer, respectively, to the data gave the second server which listens to port 8080 — domen2.tld:8080.

Have you tried using SRV records:
_http._tcp.domen1.tld. IN SRV 0 5 8080 domen2.tld.

But it did not. "Forwarding" happens... the Browser does not show the desired...

Will hear any options, but let me remind you, the main domain — IP static, the second domain is updated dynamically. The option of moving servers/domain from the first to the second or Vice versa does not offer.

PS. maybe by using iptables you can do it somehow?

UPD: Issue has been partially resolved, with the help of proxying through nginx.

UPD: the Issue is finally decided.

Config for Nginx a for those who need:

server {
listen 8080;
server_name domen1.tld www.domen1.tld;
location / {
proxy_pass domen2.tld:8080/;
"proxy_redirect" off;
proxy_set_header Host $Host:$proxy_port;
proxy_set_header X-Real-IP $remote_addr;
by | 4 views

4 Answers

0 like 0 dislike
Browsers don't support SRV
You need a trivial reverse-proxy. NginX will do.
0 like 0 dislike
1. Of course, the first thing that comes to mind is reverse proxy. Nginx advised, it is possible to make Apache and Squid — in General, there is a choice. Minus: for the second server, all requests will come as if from the first, and real addresses will have to look in the proxy logs on the ground.
2. On the "lower" level: NAT. Need a direct link between the servers (as an option, its simulation by means of VPN). The first server NATит all packets coming on port tcp/8080 for the second, and the second in the webserver hanging on 8080, configured the virtual host with the domain to which the users will access, and a rule in the RPDB that all packets coming from internal addresses to go through first.
The second option gemorroynye, but is quite efficient. I would first made.
CNAME it will help only if you want to make servers with different names, because in any case, for end-users domen1 and domen2 will point to the same address. It is possible to make a second CNAME first.
SRV HTTP is not used.
If you tell me why it is you need, maybe more than the normal solution will be offered.
If not ser
0 like 0 dislike
Banal redirect what does not fit?
0 like 0 dislike
A CNAME does not work? I have some time ago, the domain was made a CNAME for the domain * and everything worked
110,608 questions
257,186 answers
28,042 users