从 Chrome 58 开始,它不再接受依赖于Common Name
以下内容的自签名证书:https : //productforums.google.com/forum/#! topic/chrome/zVo3M8CgKzQ;context-place = topicsearchin/chrome/category $3ACanary%7Csort:相关性%7Cspell:false
相反,它需要使用Subject Alt Name
. 我之前一直在关注有关如何生成自签名证书的指南:https : //devcenter.heroku.com/articles/ssl-certificate-self,它工作得很好,因为我需要server.crt
和server.key
文件来完成我正在做的事情。我现在需要生成新的证书,其中包括SAN
我所有的尝试都没有在 Chrome 58 上工作。
这是我所做的:
我按照上面提到的 Heroku 文章中的步骤来生成密钥。然后我写了一个新的 OpenSSL 配置文件:
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
req_extensions = san
extensions = san
[ req_distinguished_name ]
countryName = US
stateOrProvinceName = Massachusetts
localityName = Boston
organizationName = MyCompany
[ san ]
subjectAltName = DNS:dev.mycompany.com
Run Code Online (Sandbox Code Playgroud)
然后server.crt
使用以下命令生成:
openssl req …
Run Code Online (Sandbox Code Playgroud) 我收到unable to get local issuer certificate
了accounts.google.com
超过SSL。我从https://curl.haxx.se/ca/cacert.pem下载了一个更新的 CA 文件并openssl s_client
用于渲染:
? ~ openssl s_client -connect accounts.google.com:443 -CAfile ~/certs/cacert.pem
CONNECTED(00000003)
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=accounts.google.com
i:/C=US/O=Google Inc/CN=Google Internet Authority G2
1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIEoTCCA4mgAwIBAgIIZMJyEcZ8LIAwDQYJKoZIhvcNAQELBQAwSTELMAkGA1UE
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
cm5ldCBBdXRob3JpdHkgRzIwHhcNMTcwMzE2MDkxNjU0WhcNMTcwNjA4MDg1NDAw
WjBtMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN …
Run Code Online (Sandbox Code Playgroud) 我代理到外部 JSON api 并尝试缓存代理响应。为了确定代理缓存是否正常工作,我添加了
add_header X-Cached $upstream_cache_status;
Run Code Online (Sandbox Code Playgroud)
并始终看到一个MISS
值。
我的 nginx 配置位置:
location /api/tides {
proxy_hide_header Cache-Control;
proxy_ignore_headers Cache-Control;
proxy_cache worldtidecache;
proxy_set_header Host www.worldtides.info;
proxy_pass https://example.com/api/$query_string;
add_header X-Cached $upstream_cache_status;
}
Run Code Online (Sandbox Code Playgroud)
在此之前我已经proxy_cache_path
设置
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=worldtidecache:100m max_size=1g inactive=48h use_temp_path=off;
Run Code Online (Sandbox Code Playgroud)
www-data
具有读/写访问权限 /var/cache/nginx
我假设proxy_buffering
设置为,on
因为我没有任何明确的设置。
nginx 配置有效。我已经测试过它nginx -c nginx.conf -t
:
??sudo nginx -c nginx.conf -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Run Code Online (Sandbox Code Playgroud)
我已经跟踪了error.log
和access.log …