Error 502 on proxy

Hi, am having a strange behaviour with Caddy and one application that am running in Golang. I have a subdomain pointing to my server:

Server IP: xxx.xxx.xxx.xxx
subdomain: my.sub.domain.com
Golang Application running on Port 4445

When I type in the browser my.sub.domain.com I receive 502 Bad Gateway
When I type in the browser xxx.xxx.xxx.xxx:4445 I can see correctly the website

My configuration for this site in the caddy file is:

my.sub.domain.com {
    proxy / https://xxx.xxx.xxx.xxx:4445 {
      max_fails 1
      insecure_skip_verify
    }
    log logs/mysite.log
}

I’m using proxy and redirecting to https because I nedd the site to works only in https. I checked the logs file and this is what I have:

xxx.xx.xxx.xx - - [27/Jul/2017:16:26:41 +0000] "GET / HTTP/2.0" 502 16

Please try this, I think it will fulfill your requirements,

https://my.sub.domain.com {
tls you@domain.com
proxy / https://xxx.xxx.xxx.xxx:4445 { transparent insecure_skip_verify max_fails 1 }
log logs/mysite.log
}

In case of, you’re not looking for ACME certifications at the time being, the command

tls you@domain.com

can be replaced by

tls /etc/path/to/crt/file /etc/path/to/key/file

@vClouds The tls directive is not required. That is not the problem here.

@Sredny_M_Casanova What does your error log say? (You’ll need the errors directive.)

Hi, I made what you said. And this is what I get:

27/Jul/2017:22:19:05 +0000 [ERROR 502 /login] tls: oversized record received with length 20527

@Sredny_M_Casanova
Please ignore tls line and proceed with errors directive as advised by @matt
I tried to help by providing my configurations @matt is the expert right here

1 Like

@vClouds Thank you for participating, though. Please continue to learn and be a part of our community!

@Sredny_M_Casanova It looks like your backend is sending invalid TLS records. What software is powering your backend?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.