Making a HTTPS request using Android Volley

后端 未结 10 1773
庸人自扰
庸人自扰 2020-11-28 19:34

I am trying to make a https request using this code:

RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
request = new Request

        
10条回答
  •  一向
    一向 (楼主)
    2020-11-28 20:20

    So far the only answer talk about adding an untrusted certificate as the solution, but since your browser doesn't complain it usually means Volley can't find the intermediate certificate that does complete the full trusted chain.

    It happened to me with LetsEncrypt certificates. Most browsers already have that intermediate certs so on browser everything looks fine, but Volley was apparently missing something.

    The solution
    Add the intermediate certificate to your webserver config. For Apache you can follow this reference:
    https://access.redhat.com/solutions/43575

    For LetsEncrypt it specifically is this file: /etc/letsencrypt/live/your.website.com/chain.pem So besides your CertificateFile and KeyFile you should already have working you now have this third line:

    SSLCertificateChainFile /etc/letsencrypt/live/your.website.com/chain.pem
    

    Just adding that line, restarting apache and Volley doesn't complain anymore and you didn't introduce any security vulnerabilities!

提交回复
热议问题