Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry if this question makes no sense (no expert here), but I understand that tomcat listens to port 8080 and that url are usually addressed to 80. Is there a way to tell DNS that urls should point to 8080? Or how should I solve this issue?

share|improve this question
possible duplicate of Directing DNS to different ports – mailq Sep 19 '11 at 18:41
I think that this article explains how SRV can be used to specify a port. However, it appears that a URI port is taken as priority over the DNS assigned port. As I understand it, web browsers automatically add port 80 to the address, which might explain why I haven't managed to get this approach to work. – Andy2K11 Oct 2 '12 at 9:06
up vote 8 down vote accepted

DNS doesn't know anything about ports. If you want to have tomcat listen on port 8080 then you have a couple of options. The first is to user the port number in the URL

If you don't like to look of that then you can use your webserver as a port proxy e.g in Apache you can use mod_proxy

<VirtualHost *:80>
        ProxyRequests Off
        <Proxy *>
                Order deny,allow
                allow from all
        ProxyPreserveHost On
        ProxyPass /
        ProxyPassReverse /
        ProxyErrorOverride Off
share|improve this answer
What if you have another host listening on port 80? I have 2 servers on one machine (required in this case) but want to hide the port number in the URL even if it is the one listening for traffic to that web server. – Jay Blanchard Jun 23 '14 at 18:35
@JayBlanchard I don't really understand your comment and wont be drawn any further other than to say read the documentation on name based virtual hosts and mod_proxy. – Iain Jun 23 '14 at 19:12

This is done by

It is not possible to give a port in the DNS. The DNS only maps names to IPs. But no ports.

share|improve this answer

I think it is best to make your tomcat to listen to port 80.You can do this if there is no other server listen to the port 80.For that you can edit server.xml

Change as follows,

<Connector port="80" protocol="HTTP/1.1" 
           redirectPort="8443" />

Now you can try will correctly resolve to your tomcat instance.Because the default port of http is 80.

share|improve this answer
I tried you example but it's not working for me – Luffy Sep 28 '15 at 10:37

There might be a possibility in solving this via DNS: SRV-Records

With SRV-Records you basically tell DNS to answer a question like "where is the httpd from"? And DNS answers with an IP-Adress AND a Portnumber.

Although I don't know if the clients requests this information or if the browser just does an A-Record lookup and requests the website from the given IP using port 80, this might be worth a try if you want to do it with DNS.

Otherwise: Let ether Tomcat listen to port 80 or redirect 8080 to Tomcat via Apache's mod_proxy.

share|improve this answer
Common browsers do not have support for SRV record lookups yet - see… and the discussion here. – the-wabbit Oct 2 '12 at 9:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.