2

I have a node js application and I am getting the headers in the browser as below, when I am using the below code. ie when I redirect to an external URL.

Request URL: ####### Request Method: GET Status Code: 302 Remote Address: 45.60.49.112:443 Referrer Policy: no-referrer

module.exports = async (req, res) => {
    try {
        let url = "https://externalurl.com";
        res.header("Access-Control-Allow-Origin", "*");
            res.redirect(encodeURI(url));
        res.header("Access-Control-Allow-Origin", "*");
            res.redirect(encodeURI(url));
    } catch (err) {
        return res.status(500).json({ msg: err });
    }
}
    

Where as when I do a express route I am getting the below headers

Request URL: ####### Request Method: GET Status Code: 302 Found Remote Address: 10.246.196.20:443 Referrer Policy: strict-origin-when-cross-origin

Why is the Referrer-policy not coming as "strict-origin-when-cross-origin" when I do a .redirect. and how to add it?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197

0 Answers0