Is dns resolve rule possible?

59 Views Asked by At

Is it possible to add port field to a dns query response in theory? Typical Query&Response: google.com -> someip:80 (for http) Desired Query&Response: google.com ->someip:5666 (for http) so web browser can make http requests to not 80 but to 5666.

1

There are 1 best solutions below

2
On

DNS resolves domain names to IP addresses, and knows next to nothing about ports.* An A or AAAA record has nowhere to put a port number. So no, you can't normally tack one on in any way clients will understand.

Some places, though -- often DNS hosting services -- offer a service known as URL forwarding. You point a domain name at their server, and they basically serve a redirect to your real site. With a redirect, the user typically sees the real URL, including the port number. They just doesn't have to type it in.

*Some types of records, like SRV records, have a field for a port number, and could actually answer a question like "Where's the HTTP server for yourdomain.com?". But since real-world browsers don't query for SRV records, you don't gain much by having one.