Can’t set Referer header

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 8.2.1
  • Operating System:
    • macOS 10.14.6

Expected Behavior

The Referer header should be able to be set on ClientRequest objects via request.setHeader(name, value).

Actual Behavior

Referer header isn’t being set at all (headers can be viewed by using a proxy like Charles or Fiddler).

To Reproduce

app.on('ready', () => {
  const { net } = require('electron')
  const request = net.request('')
  request.on('response', (response) => {
    response.on('data', (chunk) => {
    response.on('end', () => {
      console.log('No more data in response.')

  # this referer header should be set
  request.setHeader('referer', '')


Additional Information

There does seem to be a Referrer property on the request that can be seen when using webRequest.onBeforeRequest but as far as I can see it’s always empty and cannot be modified.

Being able to set the referer header is a basic and fundamental requirement for working with some websites, would be great if this issue could be fixed.

Massively appreciate all the developers taking the time working and updating this project.

1 possible answer(s) on “Can’t set Referer header