0

I am very new to consul and have registered a service with consul with following configuration. {"service": {"name": "wrapper", "tags": ["consul-wrapper"], "port":8000,"address":"127.0.0.1",}} I have also set up dnsmasq so that dns queries get resolved by consul server running on 127.0.0.1:8600

Now whenever I try to access my service like wrapper.service.consul it gets resolved and goes to port 80 instead of 8000.

What am i missing here?

1 Answers1

0

You have to ask DNS specifically for the port number... it's an SRV request.

by default DNS queries are A(or AAA for ipv6) queries, and you just get the IP address.

try asking for the SRV record directly like so:

dig SRV wrapper.service.consul

zie
  • 710
  • 4
  • 7
  • what i want is that if I `type wrapper.service.consul` in my browser it should automatically go to the correct host:port.Is it possible ? – Jeevesh Narang Jun 29 '17 at 11:32
  • NO, because browsers are basically prohibited from using SRV records. See this stackoverflow for more info: https://stackoverflow.com/questions/9063378/why-do-browsers-not-use-srv-records#9063595 – zie Jun 29 '17 at 22:18