Good day! I have the following question on express js. You need to configure the proxy on the picture that lies at http://www.somesite.ru/images/my_image.png As a result, requests for localhost: 8080 / images / good_image.png and localhost: 8080 / image.png Must send to this picture. Is it possible to do this in the express-http-proxy settings or do we need a separate redirect? I do not want to change the URL when redirecting. An excerpt of my code at the moment:

app.get ('/ image.png', function (req, res) {return res.redirect ('/ images / good_image.png');

app.use ('/', proxy (' http://www.somesite.ru/ '));

    1 answer 1

    Use 301 redirects

    res.writeHead(301, {'Location' : 'path_to_image'}); res.end(); 

    Or

     res.redirect(301, 'http://path_to_image' + req.ext)