[IIS / 2服务器在IIS服务器上使用PHP推送

问题描述 投票:0回答:1

我想通过PHP测试服务器推送。我有以下配置:

  • PHP 7.4
  • IIS 10.0
  • Opera浏览器65
  • Windows 10

这是一个很小的文件,用于查看服务器推送是否有效。这只是一个测试。

<?php header("Link: </test.css>; rel=preload; as=style"); ?>

<html>

    <head>
        <title>Test Server Push</title>
        <link href="/test.css" rel="stylesheet">
    </head>

    <body>

    <h1>Test Server Push</h1>

    <p>Hello Push!</p>

    </body>

</html>

Opera的开发人员工具向我显示了协议h2(用于http / 2)。启动器在文件test.css中说“ other”。在瀑布上,text.css还说“等待(TTFB)”。我的意思是,那不应该在那里。

它使用https并存储了有效的证书(绿色锁定)。我认为使用HTTP / 2进行服务器推送的所有要求均已满足。

Google Chrome以相同的方式显示它。

这里可能有什么错误?还是必须在IIS下的某个位置激活服务器推送?通常在HTTP / 2中默认启用此功能,对吗?

感谢您的帮助。

添加:开发者工具的屏幕截图:

带有标头命令(php):enter image description here

没有标题命令(php):enter image description here

唯一的区别在于发起者。在这里,我期望“推送/其他”。

php windows iis push http2
1个回答
0
投票

IIS仅支持通过ASP.NET或类似的推送。此外,它不像许多服务器和CDN一样通过HTTP链接标头支持。因此,据我所知,目前无法通过PHP在IIS中使用HTTP / 2推送。

https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-10/http2-on-iis#what-about-push

https://blog.cloudflare.com/using-http-2-server-push-with-php/

© www.soinside.com 2019 - 2024. All rights reserved.