HTTPS request reports CONNECTION RESET problem, TLS version server does not support

When using HttpsURLconnection or HttpURLConnection to make https requests, a Connection reset exception will sometimes be reported.

reason:

This is because the client's TLS version is not supported by the server.

For JDK1.6, SSLv2, SSLv3, and TLSv1 are supported, and TLSv1 is used by default.

For JDK1.7, it supports SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2, and uses TLSv1.1 by default.

For JDK1.8 , it supports SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2, and uses TLSv1.2 by default.

If the supported SSL protocol configured on the server is TLSv1.2, then by default only JDK1.8 can be accessed normally.

Solution: Modify the TLS version corresponding to the website configuration file in nginx to TLSv1.2.

ssl_protocols TLSv1.2.

By pressing F12 on Google Browser, the security window will pop up and you can check the current TLS version.

 

Guess you like

Origin blog.csdn.net/qq_42179736/article/details/131312550