https协议文件上传比http协议慢
一.自己写一个文件上传的接口,在浏览器文件上传https协议比http协议慢(速度上https协议是http协议的八分之一左右),在postman上传是正常的(证明代码是没有问题的),那就是协议的问题
二.经发现,改为http1.1基本上就正常了,之前是http2
1.Our speed tests are performed via browser JavaScript, and most browsers use HTTP/2 by default. We found that HTTP/2 upload speeds were sometimes much slower than HTTP/1.1 (assuming all TLS) when the user had high available upload bandwidth.
2.相关链接:
https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/
https://github.com/nextcloud/documentation/issues/9578
3.For apache, add the H2WindowSize 1048576 parameter
For nginx,add the http2_body_preread_size 1048576; parameter
Both of these can be set as global parameters