# Invalid wait time in url

**URL:** <https://discuss.hashicorp.com/t/invalid-wait-time-in-url/5569>\
**Category:** Consul\
**Tags:** consul-template\
**Created:** [February 1, 2020, 6:10am UTC](https://discuss.hashicorp.com/t/invalid-wait-time-in-url/5569 "2020-02-01T06:10:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paxman23l](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/paxman23l/32/4354_2.png) [@Paxman23l](https://discuss.hashicorp.com/u/Paxman23l)\
**Post date:** [February 1, 2020, 6:10am UTC](https://discuss.hashicorp.com/t/invalid-wait-time-in-url/5569/1 "2020-02-01T06:10:02Z")

</div>

When my consul-template in the nginx container attempts to get the healthy endpoints from my consul container, it errors out because of an error in the url: health.service(platformui|passing): Get [http://localhost:8500/v1/health/service/platformui?passing=1&stale=&wait=60000ms:](http://localhost:8500/v1/health/service/platformui?passing=1&stale=&wait=60000ms:) dial tcp 127.0.0.1:8500: connect: connection refused (retry attempt 4 after “2s”)

This is running on two separate containers on one ubuntu host. If I go to the specified url in my browser, it works just fine as long as I remove the trailing “:”. I’m new to consul, so I’m not sure exactly what I have misconfigured.

I’m using consul-template from [https://releases.hashicorp.com/consul-template/0.24.1/consul-template\_0.24.1\_linux\_amd64.tgz](https://releases.hashicorp.com/consul-template/0.24.1/consul-template_0.24.1_linux_amd64.tgz)

My template looks like:

consul {  
address = “[http://consul:8500](http://consul:8500)”  
retry {  
enabled = true  
attempts = 12  
backoff = “250ms”  
}  
}  
template {  
source = “/etc/nginx/conf.d/load-balancer.conf.ctmpl”  
destination = “/etc/nginx/conf.d/load-balancer.conf”  
perms = 0600  
command = “service nginx reload”  
}

---

<div class="post-metadata">

**Author:** ![Wolfsrudel](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/wolfsrudel/32/28465_2.png) [@Wolfsrudel](https://discuss.hashicorp.com/u/Wolfsrudel)\
**Post date:** [February 1, 2020, 2:03pm UTC](https://discuss.hashicorp.com/t/invalid-wait-time-in-url/5569/2 "2020-02-01T14:03:22Z")

</div>

Your nginx container tries to connect to localhost to find Consul, but should connect to the other container. Usually, the default docker ip range is 172.17. 0.0/16 . You should `docker inspect <consul-container>` getting its ip and configure consul-template to use this ip for connecting to Consul.  
It is working from your host because the port 8500 is exposed, I guess. But if you nginx isn’t running locally, but in a container instead, you should use the inspected ips.

---

<div class="post-metadata">

**Author:** ![Paxman23l](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/paxman23l/32/4354_2.png) [@Paxman23l](https://discuss.hashicorp.com/u/Paxman23l)\
**Post date:** [February 1, 2020, 2:37pm UTC](https://discuss.hashicorp.com/t/invalid-wait-time-in-url/5569/3 "2020-02-01T14:37:03Z")

</div>

Ah, that was it. Thank you for the help!
