tags:

views:

344

answers:

6

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?

+1  A: 

No, DNS A records only resolves host names to ip address, it doesn't know anything about port numbers.

But you can always configure your webserver to serve differents pages depending on the host header (thus, making innesesary the use of port 8080). I could give you details but i would need to know the webserver you're using.

EDIT: If you're using tomcat you should add another Host directive, the details can be found here: http://tomcat.apache.org/tomcat-4.1-doc/config/host.html

AlbertEin
Tomcat 6 is the servlet container
rcampbell
A: 

No.

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

Boris Guéry
+1  A: 

No, it's not possible. DNS controlls which IP the domain points to, it has nothing to do with the port. You can probably setup firewall rules to achieve what you want.

Draemon
+5  A: 

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.

Vladimir Dyuzhev
+2  A: 

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

Taylor Leese
A: 

You can use Dyndns.org webhop service for just that exact situation. It's free for up to 5 hosts.

jvanderh