5

How can we set the Referrer-Policy HTTP header when using Angular's HTTP Client?

I've tried setting it below but it does not work:

let headers = new HttpHeaders();
headers = headers.set('Referrer-Policy', 'no-referrer');

this.httpClient.get(url, { headers: headers };

In the HTTP request information in the browser's Network tab:

Expected:

Referrer Policy: no-referrer

Actual:

Referrer Policy: origin-when-cross-origin
Brendan
  • 834
  • 1
  • 9
  • 20
  • In what way exactly does it not work? Exactly what error messages does the browser log in the devtools console? What is the list of request headers shown when you check the Network pane in browser devtools and inspect the request? – sideshowbarker May 12 '21 at 08:35
  • @sideshowbarker Thanks I've updated the question with more detail. No errors are logged to the console but instead we see "Referrer Policy: origin-when-cross-origin" under Headers for the XHR request in the Network tab when we expect to see "Referrer Policy: no-referrer" – Brendan May 12 '21 at 09:27

0 Answers0