Hi,

I'm experiencing a lot of log in nginx :
upstream prematurely closed connection while reading upstream

Looking in my code it's because I added 

w.Header().Set("content-length", strconv.Itoa(len(w.Body.Bytes())))
If i remove it, no more logs and my clients are happy again

I use an httptest.ResponseRecorder as a response buffer.

then write the headers (content type and cookies), write the code and 
write the body wrt.Write(w.Body.Bytes()). Nothing special, if i look 
with curl the content-lenght seems to be ok.

I don't see where i did a mistake, and it's difficult to find because 
i cannot reproduce it localy.

Thanks

-- 
William

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to