caddy: Critical 502 Bad Gateway

(Are you asking for help with using Caddy? Please use our forum instead: https://forum.caddyserver.com. If you are filing a bug report, please answer the following questions. If your issue is not a bug report, you do not need to use this template. Either way, please consider donating if we’ve helped you. Thanks!)

1. What version of Caddy are you running (caddy -version)?

Caddy 0.9.4

2. What are you trying to do?

Simple reverse proxy, no load balancing to another server with http2 enabled

3. What is your entire Caddyfile?

proxy / loadbalance1:89 { 
                policy ip_hash
                fail_timeout 10s
                max_fails 1
                try_interval 250ms
                health_check /health_check
                health_check_interval 1s
                health_check_timeout 2s


                }

4. How did you run Caddy (give the full command and describe the execution environment)?

./caddy --agree --email xyz@xyz.com

5. What did you expect to see?

Proxy should be working without errors until the backend goes down

6. What did you see instead (give full error messages and/or log)?

502 Bad Gateway, Roughly 1-10% of the requests, Backend is not loaded at all 11/Jan/2017:01:02:45 +0700 [ERROR 502 /favicon.ico] no hosts available upstream

7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?

Put up a simple reverse proxy and backend and maybe visit the urls 100s of times, you are bound to get one. I can confirm the behavior with firefox browser if that matters somehow. A immediate retry gives the page successfully. Since caddy is being used in production, much logging or testing might not be possible. However, this is a serious BLOCKER. i have located this bug reported earlier, https://github.com/mholt/caddy/issues/1080 It has been marked as fixed. i am trying the temporary fix to disable http2 ( --http2=false) and i do get less errors. So the bug probably never got fixed.

Any suggestions

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (7 by maintainers)

Commits related to this issue

Most upvoted comments

with 0.9.5 it may be worth your while extending or removing the default timeouts

https://caddyserver.com/docs/timeouts