White screen issue with reverse proxy

1. Caddy version (caddy version):

newest version as of 8/23/2020

2. How I run Caddy:

caddy run

a. System environment:

Windows 10 x64

b. Command:

caddy run

c. Service/unit/compose file:

n/a

d. My complete Caddyfile or JSON config:

{
admin off
}

http://localhost {

reverse_proxy http://localhost:2001 http://localhost:2002 {
	lb_policy first
	lb_try_duration 10s
}

}

3. The problem I’m having:

I have something running on port 2002 and not 2001. Instead of noticing that localhost:2001 doesn’t lead anywhere and switching to localhost:2002, it just gives me a white screen…

4. Error messages and/or full log output:

2020/08/23 15:24:20.911 ←[31mERROR←[0m http.log.error dial tcp [::1]:2001: connectex: No connection could be made because the target machine actively refused it. {"request": {"method": "GET", "uri": "/", "proto": "HTTP/1.1", "remote_addr": "127.0.0.1:50708", "host": "localhost", "headers": {"User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"], "Accept-Language": ["en-US,en;q=0.5"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "Cookie": ["rl_anonymous_id=%22da459586-49f3-47d4-bcee-cc7fd7f8f4ce%22; rl_user_id=%22gb6y3a6z6tg988n3g1kgzn7g4r%22; rl_trait=%7B%7D; MMAUTHTOKEN=7t8hicm49t8mjfnrhtdxrq8txh; MMUSERID=cara5uicz38fugwtkdcnt4icry; MMCSRF=nsysytd8upysfkjqysx636rsya; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; token=t.shVOnqLmktFNctSAsveP"], "Upgrade-Insecure-Requests": ["1"]}}, "duration": 10.014102, "status": 502, "err_id": "t4itdzkqx", "err_trace": "reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:411)"}

5. What I already tried:

I tried messing with lb_try_duration and lb_try_interval to no avail.

6. Links to relevant resources:

n/a

And it works okay if you configure Caddy to only proxy to 2002?

I think you need to enable passive or active health checking for the “availability” clause of the first policy to work.

Actually, I think this is a firewall issue. You might need to set a rule for the caddy.exe binary to have permissions to communicate over TCP/UDP.

hi. Thank you for the reply.

I don’t think its the port causing the issue, It seems to be the specific lb_policy of first. (Or the fact that the first entry doesn’t lead anywhere.

This topic was automatically closed after 30 days. New replies are no longer allowed.