• Resolved Stian Lund

    (@pathduck)


    Hi, generally I’m very happy with this plugin, does what it’s supposed to, no fuss. And happy it’s still being updated.

    But you guys *really* need to update the UA string at least once in a while. The latest version has this in checkers/http.php:

    
    //Masquerade as a recent version of Chrome
    $ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36';
    

    That’s going to cause a lot of 403s from stupid web servers who now block really old UAs. I got one for this site:

    
    $ curl -IA "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36" https://www.nginx.com
    HTTP/2 403
    

    Changed it to:
    Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.34 Safari/537.36
    And it works again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @pathduck

    I hope you are doing well.

    We are working on a Fresh and updated engine that will use an updated UA, we don’t have an estimated time yet but our developers are working hard to make it work as soon as possible.

    Best Regards
    Patrick Freitas

    Thread Starter Stian Lund

    (@pathduck)

    Hello Patrick,
    thanks for the reply.

    A fresh and updated engine will of course be appreciated – but this is a *single-line* you can try to update at least once a year, and the http checker will continue working for most sites.

    You don’t even need to update the whole line to a valid UA, just changing Chrome/70 to Chrome/103 will do.

    Chrome 70 was released in 2018 (!)

    Best of luck with the new engine!

    • This reply was modified 2 years, 3 months ago by Stian Lund.
    • This reply was modified 2 years, 3 months ago by Stian Lund.
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @pathduck

    I passed this suggestion to our developers.

    I would actually love to see a Filter in that line of code so we could easily update the UA string using a hook.

    Best Regards
    Patrick Freitas

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @pathduck

    I hope you’re well today!

    There’s a workaround that should work fine for this (I tested it and it changes user-agent string as expected) until the feature is added to plugin.

    You’d want to add this code to the site as MU plugin:

    <?php 
    
    add_filter( 'broken-link-checker-curl-options', 'wpmudev_set_headers_ua_data', 10, 3 );
    function wpmudev_set_headers_ua_data( $curl_options ) {
    	$curl_options = array( CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.34 Safari/537.36' );
    	return $curl_options;
    }

    – create an empty file with a .php extension (e.g. “blc-ua-update.php”)
    – copy and paste code into it
    – save the file and upload it to the “/wp-content/mu-plugins” folder of your site’s WP installation

    Since then all the new checks/re-checks would use the user-agent string as set in this code. Whenever you need to change it, simply change it in the code, in this line

    $curl_options = array( CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.34 Safari/537.36' );

    Best regards,
    Adam

    Thread Starter Stian Lund

    (@pathduck)

    @wpmudev-support8
    Thank you Adam for this great tip, I will consider adding it to WP! ??

    Thank you guys for excellent support for this great plugin! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Please update UA string once in a while’ is closed to new replies.