Skip to content

Server-Timing with wp-before-template is always sent #794

Closed

Description

@szepeviktor

Bug Description

Sending of this HTTP header cannot be disabled in the plugin.
It is sent unconditionally.

perflab_register_default_server_timing_before_template_metrics();

What do you recommend? How to stop sending this header?

Steps to reproduce

  1. Just activate the plugin

Activity

  1. mukeshpanchal27 commented on Aug 8, 2023

    @mukeshpanchal27
    Member

    @szepeviktor Thank you for bringing up this issue. I fully concur with your observation that the plugin lacks an option to disable the Server-Timing API. Your input is valuable in ensuring the plugin's flexibility and user-friendliness.

    I would like to loop in @felixarntz and @joemcgill to gather their insights on this matter. Should we consider adding an option somewhere in the plugin settings to allow users to disable the Server-Timing API as per your suggestion?

    Looking forward to hearing from both of you.

  2. szepeviktor commented on Aug 8, 2023

    @szepeviktor
    ContributorAuthor

    Thank you.
    I have a process called plugin castration bomb defusing where I remove things in my special ways.
    This is the evidence warehouse: https://github.com/szepeviktor/wordpress-website-lifecycle/tree/master/mu-plugins

    Currently the shortest path to remove that HTTP header is

    add_filter(
        'get_header',
        static function () {
            header_remove('Server-Timing');
        },
        10,
        0
    );
  3. felixarntz commented on Aug 8, 2023

    @felixarntz
    Member

    Thanks for opening the issue @szepeviktor! Allowing to disable Server-Timing makes sense. It would fall under rather advanced customization, so I think this should be limited to using a code approach (rather than e.g. a UI option).

    Given that the Server-Timing logic may be initiated extra early (even before plugins are loaded), I think the most reliable and simplest solution would be to allow disabling it via a new constant that could be defined in wp-config.php, e.g. PERFLAB_DISABLE_SERVER_TIMING.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugAn existing feature is broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions