Readfrom tcp->use of closed network connection

Hi guys i have a problem, recently i often get 502 error when i open pages on my website, it happens randomly and after refresh the problem is gone, but i still want to find out why it happens.
Why i open caddy log i find
readfrom tcp [::1]:43328->[::1]:5000: read tcp 139.180.145.18:443->139.180.145.18:57442: use of closed network connection
Many messages like that.
What runs on 5000 is my nodejs server and i use proxy directive to serve it. But problem encounters not on the node website, but normal site serving php. They use different domains. I don’t like this 502 error, how can i debug it or what can be the reason.

What OS are you running Caddy on?

And, uhh, what’s your Caddyfile look like, exactly?

(friendlyurls) {
    rewrite {
	if {path} not /g10bus
        regexp ^(?:\/)?(.*?)(?:[\/])?$
        to {path} {path}/ /?q={1}&{query}
    }
}
(php-host) {
    header / Strict-Transport-Security "max-age=31536000;"
    fastcgi / /run/php/php7.3-fpm.sock php
    gzip
    expires {
        match .(png|jpg|webp|css|js|woff|woff2|svg|ico|jpeg|eot|woff2|woff|ttf)$ 1y
        match .html$ 5i30s
    }
    import mimes.conf
    status 404 {
        /core
        *.htaccess
    }
}
(http2https) {
    redir 301 {
    if {>X-Forwarded-Proto} is http
        /  https://{host}{uri}
    }
}
(ssl) {
    tls faradaytrs@gmail.com {
        must_staple
    }
}
(modx) {
    import ssl
    import http2https
    import friendlyurls
    import php-host
    redir /index.php / 301
    header / {
        X-Frame-Options SAMEORIGIN
        X-XSS-Protection "1; mode=block"
        X-Content-Type-Options nosniff
    }
}
www.globus-furniture.com {
    redir https://globus-furniture.com{uri}
    import ssl
}
www.globus-furniture.ru {
    redir https://globus-furniture.ru{uri}
    import ssl
}
globus-furniture.com, globus-furniture.ru {
    root /var/www/html/globus-furniture
    import modx
    errors /var/log/caddy/globus-furniture.error
    log / /var/log/caddy/globus-furniture.log "{combined}" {
	rotate_disable
	rotate_age 30
    }
}
mailer.globus.furniture {
    redir https://ai.globus.furniture{uri}
    import ssl
}
craft.globus.furniture {
    root /var/www/html/craft/web/
    import ssl
    import http2https
    import php-host
    rewrite {
        if {path} not /g10bus
        regexp ^(?:\/)?(.*?)(?:[\/])?$
        to {path} {path}/ /?p={1}&{query}
    }
}
ai.globus.furniture {
    root /var/www/html/mailer/
    import ssl
    import http2https
    import php-host
    rewrite / {path} {path}/ /
    errors /var/log/caddy/mailer.error
    log / /var/log/caddy/mailer.log "{combined}" {
        rotate_age 30
        rotate_disable
    }
}
api.globus.furniture, api.globus-china.com {
    root /var/www/html/mailer/api/
    import ssl
    import http2https
    import php-host
    errors /var/log/caddy/api.error
    log / /var/log/caddy/api.log "{combined}" {
	rotate_age 30
	rotate_disable
    }
}
qr.globus.world {
    root /var/www/html/mailer/api/
    import ssl
    import php-host
    redir https://api2.globus.furniture/redirect/{file}
}
www.mlchina.ru {
    redir https://mlchina.ru{uri}
    import ssl
}
mlc.globus.world {
    root /var/www/html/mlchina.ru
    import modx
    log / /var/log/caddy/mlchina.log "{combined}" {
        rotate_disable
        rotate_age 30
    }
    errors /var/log/caddy/mlchina.error
}
www.globus.world, globus-china.ru, www.globus-china.ru {
    redir https://globus.world{uri}
    import ssl
}
www.furniture-from-china-wholesale.com, furniture-from-china-wholesale.com, www.globus-china.com {
    redir https://globus-china.com{uri}
    import ssl
}
globus.furniture {
    import ssl
    redir {
	if {>Accept-Language} not_has ru
	/ https://globus-china.com{uri}
    }
    redir {
	if {>Accept-Language} has ru
	/ https://globus.world{uri}
    }
}
globus.world, globus-china.com, mlchina.ru {
    root /var/www/html/globus-world
    import modx
    log / /var/log/caddy/globus-world.log "{combined}" {
        rotate_age 30
        rotate_disable
    }
    errors /var/log/caddy/globus-world.error
}

api2.globus.furniture, api2.globus-china.com {
    proxy / localhost:5000 {
	websocket
	transparent
    }
}

System is Ubuntu 19.04 5.0.0-15-generic

I guess my issue is closely related to Im getting 502 Bad gateway errors with proxy - #2 by Whitestrake

Ubuntu 19.04

The problem was with php-fpm, i have already fixed it. Not related to Caddy. Please close.

What was the problem? Thx