-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extraHeaders doesn't work when using chrome started with --headless #5085
Comments
To clarify, everything works if you use extra headers and headless from the CLI? It's possible you've discovered a headless parity issue if this isn't the case. |
@patrickhulce when I use the lighthouse CLI I'm running When I use lighthouse as an npm.module I'm using the npm package chrome-launcher to start chrome with the |
I got all that, what I was trying to ask was if everything works as expected if you do It sounds like the command we use to set extra headers simply isn't supported by headless, in which case crbug.com is where you'd want to file an issue :) |
@patrickhulce sorry for the confusion. I've confirmed it is not working passing |
Hi @zackiles Simple steps to confirm. Create a header logging server: const express = require('express')
const app = express()
app.use((req, res, next) => {
console.log(req.headers)
next()
})
app.listen(3000) Start it with google-chrome --version
# Google Chrome 68.0.3418.0 canary
lighthouse --version
# 2.9.4
lighthouse http://localhost:3000 --chrome-flags="--headless" --extra-headers "{\"Cookie\":\"monster=blue\", \"x-men\":\"wolverine\"}"
# all headers are logged, including:
# cookie: 'monster=blue',
# 'x-men': 'wolverine', |
I'm trying to use the
output from node program:
Is this a known problem or I'm just not using the options correctly? |
@santoshjoseph99 It seems like pwmetrics passes the flags straight through to LH, so you should be able to do const options = {
flags: {
extraHeaders: {Cookie: 'monster=blue', 'x-men': 'wolverine'}
}
} seems like the original topic of this issue has been resolved though, so I'll go ahead and close this. |
@patrickhulce thank you! |
I'm using
chrome-launcher
in node to start a chrome instance with the chrome flag--headless
set. I'm then using the npm module version of lighthouse and passing it this chrome instance's port to use. When settingextraHeaders
it will only work if I don't pass the--headless
option to chrome launcher. If I remove it, the headers are sent fine to the server, if I enable it my headers are missing even though the headers show fine in the report.json underruntimeConfig.extraHeaders
.What further confuses me, is if I don't use the lighthouse npm module, and instead use the cli (bypassing the need for chrome launcher) and I pass the
--extra-headers
argument it also works fine and sends the headers correctly.I'm using the current version of lighthouse.
The text was updated successfully, but these errors were encountered: