0
router.get('/pls-redirect', function (req, res, next) {
  res.redirect("https://www.google.com")
});

Given the above express route definition, when I go to mydomain/pls-redirect, it first hits a HTTP 302 Found, with Location set to https://www.google.com.

All is good, the browser then makes a request to https://www.google.com, but why does it not set the Request header.Referrer field to say "mydomain/pls-redirect". Is there a way to achieve this?

Gavin
  • 2,784
  • 6
  • 41
  • 78
  • Does this answer your question? [Setting custom referer in Express app before redirecting](https://stackoverflow.com/questions/63689625/setting-custom-referer-in-express-app-before-redirecting) – Geshode Sep 01 '22 at 08:41
  • Hmm, I am not trying to custom set the referrer myself. But I guess the browser is just not gonna do it regardless. Given the answer on that post: `Referer headers in the HTTP protocol go from browser to server, not the other direction. If your server sends one to a browser, the browser ignores it.` – Gavin Sep 01 '22 at 08:49

0 Answers0