Skip to content

Commit 562b74b

Browse files
committed
add post https
1 parent 7996af1 commit 562b74b

2 files changed

Lines changed: 76 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Those all come from my short experience, so please read by your own risk.
5656
45. [Python 自建库的复用][41];
5757
46. [Knowledge sharing][42];
5858
47. [渠道统计][43];
59+
48. [Template Generator][44];
60+
49. [全站 https][45];
5961
1. TBD.
6062

6163
[1]: decisions/0001-record-architecture-decisions.md
@@ -100,4 +102,6 @@ Those all come from my short experience, so please read by your own risk.
100102
[40]: decisions/0044-wildcard-subdomain-resolution.md
101103
[41]: decisions/0045-reuse-python-custom-libs.md
102104
[42]: decisions/0046-knowledge-sharing.md
103-
[43]: decisions/0047-channel-tracking.md
105+
[43]: decisions/0047-channel-tracking.md
106+
[44]: decisions/0048-template-generator.md
107+
[45]: decisions/0049-moving-your-website-to-https.md
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# 49. 全站 https
2+
3+
Date: 2018-06-27
4+
5+
## Status
6+
7+
Proposed
8+
9+
## Context
10+
11+
0. 客户网络环境不佳,存在流量劫持;使用的第三方服务要求 https;
12+
1. 10+ 主域名,50+ 二级域名;
13+
2. 190+ 项目;
14+
3. 10+ 数据库表;
15+
4. 大量自行托管及第三方资源文件。
16+
17+
## Decision
18+
19+
### why
20+
21+
1. 防止流量劫持,插入广告;
22+
2. 防止账号密码等隐私数据被盗取;
23+
3. 支持 HTML5 API,如用户地理位置,音视频等隐私数据获取;
24+
4. 支持 HTTP/2;
25+
5. Apple,微信等有要求。
26+
27+
### How
28+
29+
1. 了解整个系统,统计使用到的域名及购买什么类型的域名证书;
30+
2. 相关资源支持 https,解决 Mixed Content 问题
31+
1. 针对此问题,浏览器会提示警告,Android 的 webview 直接无法打开;
32+
2. 前端页面的外链资源(CSS、JS、图片、音频、字体文件、异步接口、表单 action 地址等等)固定了协议引用(http://, https://),需更新为(//);
33+
3. 后端代码中协议是否为动态的;
34+
1. 返回接口协议应和请求协议保持一致;
35+
4. 数据库;
36+
1. 针对自有资源,应只保存路径信息,协议和域名建议动态补充;
37+
2. 针对第三方资源,默认保留原地址,跟进需要再做转换,实在不行需要做代理。
38+
5. 资源文件:确保支持 https。
39+
3. 支持 https;
40+
1. 移动端适配 https
41+
1. 针对运营商 DNS 劫持(降低 https 请求成功率),需支持两种协议,并有动态降级方案;
42+
2. nginx proxy + backend server
43+
1. 需关注 scheme 获取是否正确,注意 log 记录。
44+
3. 跳转
45+
1. 先 302 测试 https 全站正常,再 301 跳转;
46+
2. POST 请求会丢失 body 信息。
47+
4. 测试
48+
1. [https://www.ssllabs.com/ssltest/][1]
49+
4. 强制 https;
50+
5. 所有环境均要升级 https;
51+
1. 除生产外,需要将开发、测试、预发布均进行升级,保持环境的一致性,减少不可预估的问题发生
52+
6. 优化。
53+
54+
## Consequences
55+
56+
1. 性能(访问速度)有降低;
57+
2. 增加系统复杂性;
58+
3. 证书及资源(CDN 等)成本;
59+
60+
Refs:
61+
62+
1. [为什么我们应该尽快升级到 HTTPS?][2]
63+
2. [浅谈推进有赞全站 HTTPS 项目-工程篇][3]
64+
3. [启用全站HTTPS后不仅更安全而且更快 看淘宝是如何做到的][4]
65+
4. [更快更安全的HTTPS 优化总结][5]
66+
67+
[1]: https://www.ssllabs.com/ssltest/
68+
[2]: https://imququ.com/post/moving-to-https-asap.html
69+
[3]: https://juejin.im/post/5aa22db7518825558804fbac
70+
[4]: https://mp.weixin.qq.com/s?__biz=MzAxNDEwNjk5OQ==&mid=402402866&idx=1&sn=f3fde8ece13d51397c12f1a08713ebeb
71+
[5]: https://zhuanlan.zhihu.com/p/35233649

0 commit comments

Comments
 (0)