when I use Apache mod_proxy to forward my go-requests to my golang-webserver, my go-server doesn't recognize when client disconnects. I am using the close notifier:
notify := rw.(http.CloseNotifier).CloseNotify()
go func() {
<-notify
brk.closingClients <- cl.session.Value
}
When I use firewall sitepath rooting it doesn't work either. But when I use my own golang reverse proxy it works verry well without any problems. With my apache mod_proxy the client receives the notify after some more real data sended to the go webserver.
Perhaps somebody have a idea how can i solve my problem, that i recognize when clients disconnect directly, so without receiving any more data.
Here my mod_proxy configs
SSLProxyEngine On
ProxyRequests On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
ProxyPass /event https://xxx.xxx.xxx.xxx:8888/event flushpackets=on keepalive=on
The Apache server isn't going to close the connection when the client disconnects. It's much more efficient for it to reuse the connection for as long as possible.
If you really want the reverse proxy to reconnect every time (beware you may run into performance or port allocation issues), you can force mod_proxy
to use HTTP/1.0 or explicitly close the connections every time with either of:
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#envsettings