Skip to content

Enable Http2 Push Server - issue with admin page only #204

@GeeKanJi

Description

@GeeKanJi

Hi,

The context: Nginx + php7fpm + Cloudflare free plan

I enabled the Http2 Push Server feature:

  • For logged or not logged user, the front works correctly, the javascript and css files are well pushed.

  • When I access the administration pages error 502, I get a 502 error. In the nginx logs, I have "Can not Push Server (header size over 3072 Bytes)"

I tried to change the "fastcgi_buffer_size" and "fastcgi_buffer", and I modified the code of the cloudflare plugin to increase the limit "headersize":
if ($headerSize > 3072) { error_log('Cannot Server Push (header size over 3072 Bytes).'); return $src; }
to
if ($headerSize > 7168) { { error_log('Cannot Server Push (header size over 7168 Bytes).'); return $src; }
=> without success, header size were always too big (I do not understand why the headers are so big).
I looked for different solution by playing on the buffer, without success..

If I go back to my problem, the only pages that pose a problem are the administration pages, administration pages with push server enabled. I do not need to push server on these administration pages (and in general, I do not see any need).

If I disabled push server for administration pages:

    public static function initHooks()
    { 
		// Change: disable the push server if it is an admin page
		if (is_admin()) {
			return;
		};
	
        self::$initiated = true;

        add_action('wp_head', array('\CF\WordPress\HTTP2ServerPush', 'http2ResourceHints'), 99, 1);
        add_filter('script_loader_src', array('\CF\WordPress\HTTP2ServerPush', 'http2LinkPreloadHeader'), 99, 1);
        add_filter('style_loader_src', array('\CF\WordPress\HTTP2ServerPush', 'http2LinkPreloadHeader'), 99, 1);
    }

=> Everything is working fine, frontend is pushed, admin page without error and not pushed

Maybe there is a better solution? or can this solution be integrated without risk?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions