Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use lighthouse with specific cookie of login details?

I'm trying to run Lighthouse on my website from the command line.
When Chrome browser opens it comes without any cookies, therefore the desired page isn't loaded and instead I get my login page.
I tried to use --extra-headers flag when running lighthouse with a cookie, but I'm not sure this is the right way (and if so, what should be come inside "Cookie" attribute)

Running Lighthouse with:

lighthouse SITE_URL --output json --output-path ./report.json --extra-headers=./headers.json

And the headers.json file is:

{
  "Cookie": "Username=my_username; Password:my_password;"
}

Is that the right way to insert a cookie for loading a website ?
If so, what is the right syntax for custom cookies?

like image 984
Yinon Avatar asked Jan 22 '26 09:01

Yinon


1 Answers

To view the right syntax for the cookie, I logged in and copied the Session value for logging in.

{
  "Cookie": "mySession=SESSION_HASH;"
}
like image 159
Yinon Avatar answered Jan 25 '26 11:01

Yinon