I am trying to create a personal web proxy using javascript so that users can browse the internet through a website. Example http://webproxy.to/.
I'm trying to send the response back from a url to the user by using pipe request, but then it doesn't load the image because the html is using a relative url. How do I change the links so that it is using the absolute url of that page?
app.get('/:url', function (req, res) {
var url = req.params.url;
request('https://www.google.com', function (error, response, html) {
if (!error && response.statusCode == 200) {
req.pipe(request('https://www.google.com')).pipe(res);
}
});
});