• Resolved jakethesnake3p0

    (@jakethesnake3p0)


    In the admin dashboard I’m seeing in Query Monitor that there are a couple pairs of HEAD and GET requests being made each time I load the page, and both fail with 401 Unauthorized – which makes sense in a way given that my site is behind HTTP AUTH (staging site), but also doesn’t make sense given that it’s the page that’s making the request… I figured the plugin would give up on the requests after some time, but repeated page loads indicate no change in behavior. I think at a minimum, this plugin should have an enable/disable setting

    dfehc_perform_response_measurements() is the calling function with …/wp-json/?_dfehc_ts=… as the URL

Viewing 1 replies (of 1 total)
  • Plugin Support codeloghin

    (@codeloghin)

    Hi there,

    Thank you for reaching out. I appreciate your feedback.

    The plugin probes your own site’s REST endpoint to work out a baseline response time:

    1. It builds https://example.com/wp-json/?_dfehc_ts=....
    2. It tries wp_remote_head() first (quick, no body).
    3. If that fails it falls back to wp_remote_get().

    Because your staging site is protected by HTTP Basic Auth, WordPress’s HTTP API sends the probe without any Authorization: header, so Apache/Nginx responds with 401.
    From WordPress’s point of view this looks like a broken request, but the plugin simply notes the failure and falls back to the default response time. Nothing on the front end breaks, you just get extra noise in Query Monitor.

    To mitigate this on your staging setup, you can integrate the following filters either at the end of the heartbeat-controller.php file in the main plugin directory or your main functions.php file:

    add_filter( ‘dfehc_request_pause_us’, 0 );
    add_filter( ‘dfehc_num_requests’, 1 );

    If you have any other questions or if you still experience any issues, feel free to reach out.

    Best regards,

Viewing 1 replies (of 1 total)

The topic ‘Persistent 401 errors’ is closed to new replies.