I am trying get a page's HTML (on someone else's site) with an Axios GET request from my node server. But the request is returning a 403 error. The same request works on Postman.
axios(
'https://www.ssense.com/en-ca/women/product/laura-lombardi/gold-cable-chain-necklace/6378111',
{
headers: { // tried to fake the user-agent but this didn't change anything
'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36',
},
}
)
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
Some have suggested that this is a CORS issue. This confuses me. I thought cors was something that only effects browsers. If it is a CORS issue, why would it effect axios? Since I have no control over the site's server, I of course can't change their cors settings. So what is the solution?
Why can't I get the response in axios like I can in Postman? Is there some a way to get the HTML in node like postman does?