如何在特定的AJAX请求中强制使用HTTP/1.1 [英] How to force HTTP/1.1 in specific AJAX request
问题描述
背景:我们的服务器支持HTTP/2和HTTP/1.1协议.
Background: our server supports both HTTP/2 and HTTP/1.1 protocols.
但是,在测试过程中,似乎HTTP/1.1的文件上传速度要快得多.该问题的示例也可以在此处看到:使用时缓慢的GCS上传速度HTTP/2
However, during tests, it appeared that HTTP/1.1 is much faster for files upload. Example of that issue could be also seen here: Slow GCS upload speeds when using HTTP/2
问题:是否可以强制浏览器仅对某些网址/路径发出HTTP/1.1 AJAX请求?在内部,我们使用的是Axios( https://github.com/axios/axios ). >
Question: is it possible to force browser to make HTTP/1.1 AJAX request only for certain url/path? Internally we're using Axios (https://github.com/axios/axios).
推荐答案
不可能. HTTP/2是连接级别设置,浏览器将其作为HTTPS设置的一部分进行协商,并且不能被某些AJAX调用覆盖,也不能为特定路径设置.
No this is not possible. HTTP/2 is a connection level setting that is negotiated by the browser as part of the HTTPS set up and cannot be overridden for certain AJAX calls nor set for particular paths.
唯一可行的方法是将其托管在具有单独HTTPS证书的单独域中.
The only way this would be possible would be to host this on a separate domain with a separate HTTPS certificate.
这篇关于如何在特定的AJAX请求中强制使用HTTP/1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!