phantomas icon indicating copy to clipboard operation
phantomas copied to clipboard

Test failed - request throttled by proxy. Is it possible to add custom header to a config?

Open ilyamr opened this issue 2 years ago • 1 comments

Hello,

Is it possible to add a custom header to avoid throttling by such tools as Akamai etc.?

For example, check of https://darphin.com/ will always timeout.

I'm using yellowlab tools as an example but it fails in CLI too. image

But with adding a custom request header this problem is gone. Such a feature is available on https://webpagetest.org image

Please let me know if it's possible. I can also contribute but would appreciate a direction to make it happen faster. Thank you.

ilyamr avatar May 17 '22 15:05 ilyamr

Good idea!

  • First, you can take a look at a userAgent extension on how to handle options and customise puppeteer run. https://github.com/macbre/phantomas/blob/devel/extensions/userAgent/userAgent.js
  • And use puppeteer API to set a custom request header before the page is open. https://pptr.dev/#?product=Puppeteer&version=main&show=api-pagesetextrahttpheadersheaders

Let me know if you need more hints. Looking forward to the PR ;)

macbre avatar May 19 '22 18:05 macbre