Open iidear opened 5 years ago
浏览器、音视频、邮箱、IM、App、游戏、curl
HTTP(网页) HTTPS(安全网页) SMTP(邮件发送) POP3(邮件接收) DNS(域名解析) DHCP(动态活动IPDNS服务器等参数) CIFS(Windows 文件共享协议) NFS(Unix/Linux 文件共享) NTP(时钟同步) RTP(IP多媒体电话的语音、文字、视频等流体的传输) SSH、FTP、RTSP、Gopher、IRC、Telnet、SNMP、IMAP、LDAP、…
VPN(链路层) SOCKS(会话层) Charles(应用层) …
在互联网应用开发中,前端常常需要与网络打交道。前端日常面临的网络相关的问题主要涉及以下几个方面:
https 指在 http 协议之下增加一层安全协议(TLS)。
TLS 协商关键词:
https 服务器:生成证书 --> CA 认证证书 --> 服务器配置证书 https 客户端:预置根证书 --> 请求服务器 --> 服务器返回证书(公钥) --> 验证服务器证书 --> 使用公钥加密对称密钥发送给服务端。
操作系统根证书库可添加自签证书。
openssl genpkey -out fd.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048
openssl req -new -key fd.key -out fd.csr
echo "subjectAltName = DNS:*.domain.com, DNS: domain.com" > fd.ext
openssl x509 -req -days 365 -in fd.csr -signkey fd.key -out fd.crt -extfile fd.ext
const https = require('https');
const fs = require('fs');
https.createServer({ key: fs.readFileSync('./fd.key'), cert: fs.readFileSync('./fd.crt'), }, (req, res) => { res.writeHead(200); res.end('hello world\n'); }).listen(8000);
5. 系统配置信任自签证书
+ Mac 启动台 --> 钥匙串访问
+ Chrome 浏览器 --> chrome://settings/security --> 管理证书
### 参考
+ [openssl cookbook](https://www.feistyduck.com/library/openssl-cookbook/online/ch-openssl.html)
没有设置
Cache-Control
请求头,chrome 返回了200 (from memory cache)
原因: 没有设置
Cache-Control
请求头,但设置了Last-Modified
请求头,浏览器会启发式的计算一个强缓存时间.在 Chrome 75.0.3770.100 中测试,符合上面的解释。