Skip to content Skip to sidebar Skip to footer

Java.io.ioexception: Stream Was Reset: Refused_stream On Several Devices

I'm using Retrofit 1.9 in my Android app. Server is on Django with Nginx, HTTPS with HTTP 2. Certificate is from WoSign, 'A' score on SSL Labs. I'm testing on 3 devices: Nexus 4,

Solution 1:

If anyone is still having a problem (2018).

I've solved that issue by updating retrofit version to

 implementation 'com.squareup.retrofit2:retrofit:2.4.0'

Solution 2:

I've solved this. It's a Nginx bug

This issue was fixed in Nginx 1.11. So, the solution is just to update to NGINX 1.11 (mainline currently).

Solution 3:

In my case, nginx was already updated to 1.11.x. The culprit for me was okhttp and retrofit. When I tried to make a PUT request, it would fail with stream was reset: REFUSED_STREAM.

To fix it, I upgraded to the latest versions of both, which at the time I'm writing this are:

compile'com.squareup.retrofit2:retrofit:2.1.0'compile'com.squareup.okhttp3:okhttp:3.5.0'

If you're using retrofit 2.0.x or okhttp 3.1.x, upgrading should fix the issue.

Post a Comment for "Java.io.ioexception: Stream Was Reset: Refused_stream On Several Devices"