• Peter

    (@petert-1)


    Our debug log is getting filled with these messages as of the last update (2.1.5):

    [24-Nov-2020 17:46:27 UTC] Servebolt Optimizer attempted to set header “Cache-Control: max-age=0,no-cache,s-maxage=0”, but headers already sent.
    [24-Nov-2020 17:46:27 UTC] Servebolt Optimizer attempted to set header “Pragma: no-cache”, but headers already sent.
    [24-Nov-2020 17:46:27 UTC] Servebolt Optimizer attempted to set header “X-Servebolt-Plugin: active”, but headers already sent.
    [24-Nov-2020 17:46:27 UTC] Servebolt Optimizer attempted to set header “cf-edge-cache: no-cache, platform=wordpress”, but headers already sent.
    [24-Nov-2020 17:46:27 UTC] Servebolt Optimizer attempted to set header “No-cache-trigger: 1”, but headers already sent.

    Everything on our site is up to date.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Pieter Daalder

    (@wizzard_)

    Hi Peter!

    Normally this behaviour shouldn’t occur. What settings are you using on our plugin? And could you check if the problem persists when you disable all other plugins?

    Hello! This is unfortunately a long standing bug in our plugin and it is related to PHP buffer size and usually caused by plugins sending output too early in the loading process. Some websites experience this and others don’t – it all boils down to the complex setup of a website. Let my try to explain:

    We set the cache headers pretty late in the WP load cycle, and this is because we need to resolve for example the current post to see if we should actually cache it or not. Unfortunately some plugins/themes output data very early in the loading process – this can be anything from whitespace, markup, or error messages. This output will in many cases exceed the PHP buffer size, and this again causes the headers to be sent early since the headers will be the first part of the HTTP response. This again causes us to act too late and we’re then not able to set the correct cache headers.

    This is unfortunately a bit tricky to debug. One solution is to increase the PHP buffer size, but the best solution is to find out what causes this output before WP starts to print the actual template markup. One way of doing this is deactivating plugins one by one and see when the “headers already sent” message disappears. If the error still persists after plugins are deactivated then I would check elsewhere, perhaps in the themes, in mu-plugins, perhaps even trying to reinstall WordPress. I hope this helps, and I sincerely wish we had a better solution to this, but the way WordPress is structured makes it a bit hard.

    Kind regards
    Robert from Servebolt

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Warnings in debug.log – attempted to set header’ is closed to new replies.