Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23693

Http Headers are not set when using FastCGI

    Details

      Description

      The HTTP Status code is sent like this in many parts of ez:

      header( $_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified' ); // results in 'HTTP/1.1 304 Not Modified' 

      This does not work for FastCGI (PHP-FPM) since the HTTP status needs to be this instead:

      Status: 304 Not Modified

      Resulting in HTTP 200 Codes instead which results in strange bugs like sending an empty tree menu with a 200 instead of 304, a login page with a 200 instead of 401 and so on.

      Some ways of sending the header working with FastCGI are documented here: http://stackoverflow.com/questions/3258634/php-how-to-send-http-response-code

      What do you think? I see two easy possibilities: add a function to the ezhttptool and include this everywhere or just add the third argument of `header()`.

        Activity

        Hide
        Bertrand Dunogier added a comment -

        Interesting... I take it that this is only happening on the legacy stack right ?

        Show
        Bertrand Dunogier added a comment - Interesting... I take it that this is only happening on the legacy stack right ?
        Hide
        Jakob Stoeck added a comment - - edited

        A quick search shows that this way of setting the header is used only in legacy, yes:

        ezpublish/ezpublish_legacy/index_cluster.php:
        ezpublish/ezpublish_legacy/extension/ezjscore/modules/ezjscore/call.php:
        ezpublish/ezpublish_legacy/extension/ezjscore/modules/ezjscore/run.php:
        ezpublish/ezpublish_legacy/extension/eztags/index_treemenu_tags.php:
        ezpublish/ezpublish_legacy/extension/eztags/modules/tags/treemenu.php:
        ezpublish/ezpublish_legacy/kernel/class/edit.php:
        ezpublish/ezpublish_legacy/kernel/classes/ezsiteaccess.php:
        ezpublish/ezpublish_legacy/kernel/clustering/gateway.php:
        ezpublish/ezpublish_legacy/kernel/content/treemenu.php:
        ezpublish/ezpublish_legacy/kernel/private/classes/ezpkerneltreemenu.php:
        ezpublish/ezpublish_legacy/lib/ezutils/classes/ezhttptool.php:
        ezpublish/ezpublish_legacy/lib/ezutils/classes/ezmodule.php:
        […]

        Show
        Jakob Stoeck added a comment - - edited A quick search shows that this way of setting the header is used only in legacy, yes: ezpublish/ezpublish_legacy/index_cluster.php: ezpublish/ezpublish_legacy/extension/ezjscore/modules/ezjscore/call.php: ezpublish/ezpublish_legacy/extension/ezjscore/modules/ezjscore/run.php: ezpublish/ezpublish_legacy/extension/eztags/index_treemenu_tags.php: ezpublish/ezpublish_legacy/extension/eztags/modules/tags/treemenu.php: ezpublish/ezpublish_legacy/kernel/class/edit.php: ezpublish/ezpublish_legacy/kernel/classes/ezsiteaccess.php: ezpublish/ezpublish_legacy/kernel/clustering/gateway.php: ezpublish/ezpublish_legacy/kernel/content/treemenu.php: ezpublish/ezpublish_legacy/kernel/private/classes/ezpkerneltreemenu.php: ezpublish/ezpublish_legacy/lib/ezutils/classes/ezhttptool.php: ezpublish/ezpublish_legacy/lib/ezutils/classes/ezmodule.php: […]
        Hide
        Sebastian Blank added a comment -
        Show
        Sebastian Blank added a comment - I created a PR: https://github.com/ezsystems/ezpublish-legacy/pull/1129
        Hide
        André Rømcke added a comment - - edited

        Why wasn't this reported before? is this caused by use of php-fpm? Cause people have been using fastcgi, mostly with Apache and lighthttpd for years (unofficially) so a bit surprised something like this comes in now after so many years.

        Show
        André Rømcke added a comment - - edited Why wasn't this reported before? is this caused by use of php-fpm? Cause people have been using fastcgi, mostly with Apache and lighthttpd for years (unofficially) so a bit surprised something like this comes in now after so many years.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jakob Stoeck
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: