i have a url and when i called that url using browsers and postman it is working fine but using axios it is throwing 404 error,i will be grateful if someone help me out to clear this error
iam giving the snippet of code where iam facing problem
let response = await axios.get(`https://scholar.google.co.in/citations?user=sGJSZ1AAAAAJ&hl=en&cstart=0&pagesize=1000`, {
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
},
});
i checked whether url is correct or not then i found that there is no mistake in url then i added the user-agent header but no use
Your request is being blocked by the CORS policy.
For the local development you can use this extension:
But the right solution is to set up a basic proxy server for your requests. This is how you can do it:
npm initto create a package.json file"type": "module"inpackage.jsonnpm i cors express node-fetchnode index.jsin your terminalThis will return you the HTML of that page.