question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Pagespeed API] Support custom user agent in pagespeed API

See original GitHub issue

Pagespeed exhibits bot like behavior which can get caught by our bot detection mechanisms, preventing us from measuring pagespeed. I’d like to request the addition of a custom user agent param for pagespeed to use. We can then whitelist the specified user agent to allow pagespeed to run correctly. Alternatively, if you could provide the network blocks from which the pagespeed is run, we can whitelist those.

Provide the steps to reproduce

  1. Visit https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.redfin.com

What is the current behavior?

Page can show an error saying: Lighthouse returned error: ERRORED_DOCUMENT_REQUEST. Lighthouse was u nable to reliably load the page you requested. Make sure you are testing the correct URL and that the server is properly responding to all requests. (Status code: 403) (It may not error out all the time. We’ve temporarily whitelisted the block 66.249.84.0/24, but I believe that block is used for more than just page speed.)

What is the expected behavior?

Pagespeed runs without an error.

Environment Information

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
paulirishcommented, Apr 28, 2020

If you need to identify that its a Lighthouse pageload that you initiated, consider adding a special URL param.

Also, you can always clone Lighthouse and run the CLI locally with whatever changes you want. 😃

0reactions
angelogulinacommented, Jun 13, 2019

PSI does include Chrome-Lighthouse in the request User-Agent. Is that sufficient to filter for?

Jumping in the conversation (hopefully relevant) given it’s still Open.

Thought the Chrome-Lighthouse is provided, it would be nice to be able to add additional User-Agent parts. Now, as far as I could see from here and here it should be actually possible to do that.

But, if I look at the generated json, I cannot find any trace of the additional part I added. To be fair, I still haven’t tested it from the server-side part - but I suppose that additional User-Agent parts should also be displayed in the json from lighthouseResult > environment> networkUserAgent.

Or am I doing / getting something wrong?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get Started with the PageSpeed Insights API
Use the PageSpeed Insights API to: Measure the performance of a web page. Get suggestions on how to improve the page's performance, accessibility,...
Read more >
How to See Your Website From PageSpeed Insights ...
This lets you create a new simulated device with a custom User-Agent. Custom Device DevTools. From here, you can simply copy and paste...
Read more >
Which User Agent use Google PageSpeed? - Stack Overflow
Looking deeper into the logs of my server and printing the http header user-agent i found the User Agent from Google Page Speed...
Read more >
The PageSpeed Insights API - AddyOsmani.com
Teams use the API to build dashboards, custom reports and custom integrations with other user-experience measurement tools.
Read more >
PageSpeed Configuration - Mod_Pagespeed
As Apache 2.4 is not API compatible with 2.2, support for it is provided via a ... change may not get applied on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found