unexpected EOF error in golang httpclient 1.18 and reverseproxy


We have implemented gateway appication which basically reroutes the request to target server (spring boot app). For gateway we are using golang 1.18.

Intially we have used the reverseproxy from golang to forward the request, but in prodcution we were seeing unexpected EOF, so we thought the issue related might be due to the reverseproxy.go and changed to the httpclient with below configuration.

httpClient = &http.Client{ Timeout: 60, //seconds Transport: http.DefaultTransport.(*http.Transport).Clone(), }

but still we could see the unexpected EOF error in prodcution. this is happening intermittently in prod env but not able to reproduce in dev env.

Env specification below deployed env - cloud foundary client app - mobile api gateway golang version - 1.18 targer server app - spring boot (2.5.14) , java 11

  • We have moved code from reverseproxy to the httpclient.
  • Instead of default transport , we have used the custom transport , increased the time out
  • We hvae closed the request using Request.close method.

We have tried with replicated the same request and headers from mobile app, still we were not able to reproduce the issue in dev env.

Could you please suggest me the way to reproduce the similar error in dev env ? Any fixes for unexpected EOF error in production ?