Open abarre opened 4 years ago
Did the UA modifier ever work in Lighthouse? In all of my testing Lighthouse would ignore it. The Lighthouse team have always maintained that this is the expected behaviour (https://github.com/GoogleChrome/lighthouse/issues/9927)
FWIW the Chrome-Lighthouse modifier was already present in mobile tests. #297 made sure it was present in desktop tests too. You should be able to whitelist this string in your bot detector.
Sorry @abarre, I forgot to mention how the lighthouseConfig
option works. It's a JSON string that is stored in a local file on the test agent and passed to the --config-path
option of Lighthouse.
You can generate JSON for the built-in Lighthouse configs relatively easily. For example the PageSpeed mobile config:
> JSON.stringify(require("lighthouse/lighthouse-core/config/lr-mobile-config"))
'{"extends":"lighthouse:default","settings":{"maxWaitForFcp":15000,"maxWaitForLoad":35000,"skipAudits":["uses-http2"]},"audits":["metrics/first-contentful-paint-3g"],"categories":{"performance":{"auditRefs":[{"id":"first-contentful-paint-3g","weight":0}]}}}'
The UAModifier option is not applied on lighthouse.
I suspect that this PR introduces an issue.
For a bit of context, we use the
UAModifier
setting to configure bot detector such as Datadome. Currently, the bot detector blocks the lighthouse run. The bot detector doesn't receive theUAModifier
string. I suspect that it receiveChrome-Lighthouse
instead that is flagged asBad IP Reputation, DDOS Attack et Fake Chrome Browser
.I think that
--chrome-flags user-agent
should always be set when theUAModifier
is specified regardless of theemulatedFormFactor
.Also, I can see that this commit introduces an option
lighthouseConfig
. Can you clarify how we can use this option ? It is available in the API ?After reading https://github.com/GoogleChrome/lighthouse/issues/10910, I am not sure that this can be solved without lighthouse update.
CC @wildlyinaccurate