首页 新闻 赞助 找找看

https链接无法通过程序访问

0
悬赏园豆:50 [已解决问题] 解决于 2019-07-12 18:55

今天在centos7中使用nginx+python部署了一个程序接口,并且添加了ssl证书验证,但是最后访问的时候使用浏览器访问 https://接口,可以正常访问,但是使用代码访问时会出问题,比如说使用python的requests库进行访问,requests.post('https://') 会出现 HTTPSConnectionPool: Max retries exceeded with url 问题,必须加上 verify=False才能够访问,请问可以通过修改服务器中的配置让程序(所有程序,不限于python)不设置忽略证书直接访问吗?

清洁人的主页 清洁人 | 初学一级 | 园豆:39
提问于:2019-07-12 17:01
< >
分享
最佳答案
0

用 curl 命令可以正常请求吗?

收获园豆:50
dudu | 高人七级 |园豆:31075 | 2019-07-12 18:09

使用curl 链接时会显示:
curl: (60) Peer's Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
请您看一下

清洁人 | 园豆:39 (初学一级) | 2019-07-12 18:24

@清洁人: 需要使用权威证书,现在主流的云服务商都提供了免费的 https 证书,或者使用 letsencrypt 生成证书

dudu | 园豆:31075 (高人七级) | 2019-07-12 18:29

@dudu: 谢谢您,帮大忙了

清洁人 | 园豆:39 (初学一级) | 2019-07-12 18:55
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册