【问题标题】:ob_start difference between https and http?ob_start https 和 http 的区别?
【发布时间】:2016-11-23 12:37:36
【问题描述】:

与 http 相比,https 中的 ob_start、ob_end_flush、ob_end 和 ob_flush 的行为是否不同?

我已经阅读了有关 http 和 https 之间区别的帖子:

Difference between http and https

Difference between HTTPS and SSL

我已经读过这篇关于 ob_start & headers 的文章:

Showing error pages when sending header with header() function

但我没有找到我需要的答案。

我的案例:

我在两个网站上使用 ob_start 刷新加载图像。 他们使用完全相同的代码。 唯一的区别是协议 - 一个是 http,一个是 https。

http 很好

使用 http 的网站会输出图像,然后继续执行脚本。

https 的行为不同

使用 https 的网站总是在脚本完全处理后输出图像。

谢谢。我很高兴有任何提示。

【问题讨论】:

    标签: php http https http-headers ob-start


    【解决方案1】:

    我看到了两种可能性:

    • HTTPS 以块(记录)的形式发送数据,可能是16KB large。如果您的图像小于该值,服务器可能会在发送完整块之前等待更多数据。

    • 您的 HTTPS 是由反向代理实现的,代理会等待整个响应发送完毕,然后再转发任何内容。

    如果您使用的是 php-fpm,请尝试http://php.net/manual/en/function.fastcgi-finish-request.php

    如果您使用的是 nginx,请尝试http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering

    【讨论】:

    • 感谢 Kornel,等待的是反向代理。如果我使用没有 php-fpm 的 apache,有没有办法克服这个问题?
    猜你喜欢
    • 1970-01-01
    • 2012-01-12
    • 2018-12-15
    • 2019-04-28
    • 1970-01-01
    • 2015-08-30
    • 2016-07-28
    • 1970-01-01
    • 2011-08-30
    相关资源
    最近更新 更多