服务器发送http不响应,虽然服务器在响应头中发送“Upgrade:h2”,但无法向Apache服务器发出http2请求 - apache代码 - 源码查...

该博客讲述了在Apache Web Server上启用HTTP/2后,浏览器仍然使用HTTP/1.1的情况。问题在于服务器发送了Upgrade头,但浏览器未升级到HTTP/2。解决方案是更新SSL配置,使用特定的加密套件,并确保不使用黑名单中的加密算法。在更改httpd配置文件并重启服务后,应避免出现NS_ERROR_NET_INADEQUATE_SECURITY错误。

问题

I have enabled mod_http2 for the Apache Web Server, and made the necessary changes in the conf, still any request made from a browser to the server follows http/1.1 Protocol

The server sends a Upgrade:h2 header field but the browser still continues to make http/1.1 requests.

IwgOj.png

rrW7q.png

How can i make a h2 request from Mozilla/Chrome?

I'm using Mozilla Firefox 48.0

解决方法

The HTTP/2 standard imposes some extra requirements on https, no cipher from a specified black list may be used.

An acceptable Apache SSL configuration regarding this is:

SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK

SSLProtocol All -SSLv2 -SSLv3

This needs to be changed in the httpd config file and NS_ERROR_NET_INADEQUATE_SECURITY should not occur after httpd restart.

C:\Users\admin>curl -k -v -b cookies.txt -X PROPFIND -H "Depth: 1" "https://fileshare-cd.tp-link.com/remote.php/dav/files/husiyu@tp-link.com.hk/" * Host fileshare-cd.tp-link.com:443 was resolved. * IPv6: (none) * IPv4: 10.13.136.24 * Trying 10.13.136.24:443... * schannel: disabled automatic use of client certificate * ALPN: curl offers http/1.1 * ALPN: server accepted http/1.1 * Connected to fileshare-cd.tp-link.com (10.13.136.24) port 443 * using HTTP/1.x > PROPFIND /remote.php/dav/files/husiyu@tp-link.com.hk/ HTTP/1.1 > Host: fileshare-cd.tp-link.com > User-Agent: curl/8.10.1 > Accept: */* > Cookie: __Host-nc_sameSiteCookiestrict=true; __Host-nc_sameSiteCookielax=true; oc_sessionPassphrase=8efm%2B84zGiNK95DvPaSwVdwEI7B86sscqGQGnWK4fPTTIEAdDI3QQ5EXFH%2FTbt7Lx%2FoyiadUEH8YryOnIbZNumTRzY5hFQrZyagIcd61Hic%2FY1ou9DApu7ElGQ%2F%2BN5S1; ocas9uhx9acd=grdcvu9hfjd1io8512tf4aru72 > Depth: 1 > * Request completely sent off < HTTP/1.1 401 Unauthorized < Date: Tue, 02 Dec 2025 06:50:23 GMT < Server: Apache/2.4.58 (Ubuntu) < Strict-Transport-Security: max-age=15768000; includeSubDomains < Referrer-Policy: no-referrer < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < X-Permitted-Cross-Domain-Policies: none < X-Robots-Tag: noindex, nofollow < X-XSS-Protection: 1; mode=block < Upgrade: h2,h2c < Connection: Upgrade < Content-Security-Policy: default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self' * Replaced cookie ocas9uhx9acd="grdcvu9hfjd1io8512tf4aru72" for domain fileshare-cd.tp-link.com, path /, expire 0 < Set-Cookie: ocas9uhx9acd=grdcvu9hfjd1io8512tf4aru72; path=/; secure; HttpOnly; SameSite=Lax < WWW-Authenticate: Basic realm="fileshare", charset="UTF-8" < Content-Length: 527 < Content-Type: application/xml; charset=utf-8 < <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>服务器内部错误</s:exception> <s:message> 服务器能完成您的请求。 如果再次发生这种情况,请将下面的技术详细信息发送服务器管理员。更多细节可以在服务器日志中找到。 </s:message> <s:technical-details> <s:remote-address>10.13.34.170</s:remote-address> <s:request-id>qhcGu23hjgPDZQ84eCF3</s:request-id> </s:technical-details> </d:error> * Connection #0 to host fileshare-cd.tp-link.com left intact
最新发布
12-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值