PhantomJS (as of version 1.6.1, released Jul 24th 2012) offers a way to set custom request headers using
. It works great to the extent that it creates and sends the http request with your custom headers. It fails however to set the
I created a workaround to fake the referrer with a phantomJS Script, and a patch that changes the behaviour of phantomJS. You can use both, depending on your needs. The Workaround includes an additional pageload for every requests and is not 100% reliable since its based on injecting a link to the (referring) page and simulating the click. This is probably not what you want for larger scale tests and scans.
You can find my basic fix on Github. It passes your custom Headers to the request object and thereby makes the referrer visible to the page: https://github.com/papoms/phantomjs/commit/6f738b06a02e2aaee1c18859b76132e5932334e0