Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

By modifying my DNS records, how can I have "test.mydomain.com" resolve to XXX.XXX.XXX.XXX:8080?

Tags:

dns

First, this is a programming question because I'm trying to set up a test/QA server running alongside a production server.

Second, yes I should post this on Serverfault, but I tried logging in with THREE different OpenID providers, and every time I get an error saying this this provider isn't supported in the Beta (even though the icon is right there). To post a question you must log in.

Whew, okay.

Currently I have one A record with @ host pointing to my server IP, let's say 111.11.11.11. I then have a CNAME record with www host pointing to @ from my A record.

The problem is that I have a different web server running on 111.11.11.11:8080. I'd like to make another CNAME so that test host points to something like @:8080

To summarize:

www.mydomain.com should resolve to 111.11.11.11

test.mydomain.com should resolve to 111.11.11.11:8080

Is this possible? If so, how?

like image 613
Robert Campbell Avatar asked May 16 '09 18:05

Robert Campbell


3 Answers

DNS A (address) record doesn't have port number. So, not, that is not possible.

What's possible is to have another IP for the same machine (e.g. 111.11.11.12) and let test.mydomain.com resolve to it. Then your first server should listen on the first IP only, and second on the second only.

P.S. There are DNS SRV records that allow to specify the port, but browsers DO NOT use them, alas.

like image 149
Vladimir Dyuzhev Avatar answered Nov 17 '22 04:11

Vladimir Dyuzhev


DNS only resolves to an IP address. However, if you have DNS resolve to an IP where Apache is located then you can use mod_proxy to proxy the request to an application server on port 8080. See this link.

http://www.jboss.org/community/wiki/UsingModproxyWithJBoss

like image 3
Taylor Leese Avatar answered Nov 17 '22 03:11

Taylor Leese


No.

You can't define a port inside your dns configuration. It's not its purpose. It's just about ip -> host and reverse.

like image 1
Boris Guéry Avatar answered Nov 17 '22 02:11

Boris Guéry