How to send extra http header parameters to server in headless mode

985 views
Skip to first unread message

stepha...@gmail.com

unread,
Sep 6, 2017, 4:10:45 AM9/6/17
to headless-dev
Hi all,

I'm using "google-chrome" in headless mode in Debian-8.7 which works with our own proxy-server. I use sth like:
# google-chrome --headless .... --proxy-server=A.B.C.D:X http://example.com

 My problem is that, I want chrome to send some extra http header parameters to our proxy-server along with the usual parameters in request. (in phantomjs this could be done by writing any extra http header (field:value) pair in its input js file)
I searched but couldn't find anything that could do this for me.

Can this work be done by chrome and how?
Thank you for your time.

Alex Clarke

unread,
Sep 6, 2017, 4:19:44 AM9/6/17
to stepha...@gmail.com, headless-dev
DevTools supports this, you can use Network.setExtraHTTPHeaders to do this.  You can also use Network.setRequestInterceptionEnabled and arbitrarily modify the headers for intercepted requests Network.continueInterceptedRequest, although that's probably overkill for your use case.

...

[Message clipped]  

Reply all
Reply to author
Forward
0 new messages