Avatar of gd6627
gd6627Flag for United States of America asked on

Adding a port to the cname record

How can i create a cname record to a web server that uses a particular port ?

I already have the dns record but i need to create a cname can i add the port number to the FDQN section of the cname?
DNSActive Directory

Avatar of undefined
Last Comment

8/22/2022 - Mon
Cliff Galiher

Can't be done. That isn't the intent of DNS and the DNS standards offer no means to do this nor would a client understand what it means if you did.
Coolie Sheppard

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Browsers use hardcoded ports 80 for http & 443 for https. UNLESS otherwise specified in the URL.
So your users will need to type it.


You could setup a presite page which contains a link / redirect with the port number hardcoded.

Users would go there first (for such a simple page, you might even use free hosting or at least very cheap), then get sent on to the real site using the non standard port number.

Your help has saved me hundreds of hours of internet surfing.

DNS only is about hostnames.. ( and then only for humans, machines don't care about the names, the real communication is using IP addresses.
Shaun Vermaak

No need for additional IP addresses.

In bindings of site add a host header. This way you can have multiple sites on same port and IP, similar to shared hosting

Jeff Glover

The only way I know of to accomplish this is available via GoDaddy or by making your own website. If you use GoDaddy as DNS, there is a feature called domain/subdomain forwarding. You list the subdomain you want to forward (like www) and list the entire URL you want it to go to. You can include a port on the end of the URL there.
  You can do the same thing by creating a redirect site in IIS. Simply make an empty site there and use IIS redirection to redirect traffic to the correct port.
  This may be available via other DNS hosting providers, not sure. We only use GoDaddy.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

The question was about a port... not a different name.
Jeff Glover

And we answered him about that. Can't be done in DNS with a cname record. Period. However, as is our way, we suggest ways around it.

Thanks everyone I get that you cant assign a port in DNS but I was trying to make the user experience better by not having them type the FQDN literally so I created a friendly CNAME record but I didn't know how to direct the user to the actual port of the app on the server .

I wanted to know how to do that without having to deploy or create a short cut with the port assigned in the url.
I wanted the user to open a browser and type for example  MYApp and it would just go to the UI of the server

Cooli had the explanation I needed
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy