ProtocolException: The expected header ": status" is missing

Reinstalling network calls fails with a protocol exception in the production application. The application worked until yesterday, and today all network calls fail. Calls work fine with HTTP, but not with HTTPS.

Here are the magazines

java.net.ProtocolException: Expected ':status' header not present 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.Http2xStream.readHttp2HeadersList(Http2xStream.java:262) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:145) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 10-18 14:59:01.103 30746-30746/? W/System.err: at codmob.com.campuswallet.app.ApiClient$1.intercept(ApiClient.java:66) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 10-18 14:59:01.103 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 10-18 14:59:01.104 30746-30746/? W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 10-18 14:59:01.104 30746-30746/? W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 10-18 14:59:01.104 30746-30746/? W/System.err: at okhttp3.RealCall.access$100(RealCall.java:33) 10-18 14:59:01.104 30746-30746/? W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 10-18 14:59:01.104 30746-30746/? W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 10-18 14:59:01.104 30746-30746/? W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 10-18 14:59:01.104 30746-30746/? W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 10-18 14:59:01.104 30746-30746/? W/System.err: at java.lang.Thread.run(Thread.java:761) 
+7
android retrofit retrofit2
source share
3 answers

After hours of confusion, finally a solution came out. Updating the Retrofit and Okhttp3 library to the latest version helped me.

 compile 'com.squareup.okhttp3:okhttp:3.9.0' compile 'com.squareup.retrofit2:retrofit:2.3.0' 
+3
source share

Today I encountered the same problem. The reason was updating nginx on the server to the latest version (1.13.6). Ask your backend team if they have not updated nginx on the server.

nginx changelog - http://nginx.org/en/CHANGES

+2
source share

I am using OkHttp2 (2.7.5), and I solved this problem by forcing the client to use the HTTP 1.1

 OkHttpClient client = new OkHttpClient(); client.setProtocols(Arrays.asList(Protocol.HTTP_1_1)); // <- add this line 
+2
source share

All Articles