I see the solution to this nowhere, and yet have the question:
How to proxy fetch requests in chrome extensions?
I have this code:
async makeRequest() {
const postData = {
// ..payload
};
const jsonData = JSON.stringify(postData);
const url = "http://127.0.0.1:8000/endpoint/";
try {
// HERE I WANT TO USE PROXY!
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: jsonData,
});
return response;
} catch (error) {
console.error("Error during fetch:", error);
return false;
}
}
My app is a webscrapping chrome extension, therefore the usage of proxies for my webscrapping purposes is fundamental.
Also saw that we can use the proxies
manifest permission, but the problem that I run into using that implementation is that configures the Proxy for the WHOLE COMPUTER, and i only want it for the chrome extension requests.
Any solution?
Thanks!