0

As far as I know, the reason why duplication request is occurring in chrome is to get /favicon.ico in the first request and URI in the second request. But as you can see in my simple test code, exactly the same URL is being accessed for both requests, not for getting /favicon.ico from the first request. This brings unexpected result in my project.

express Code

app.get('/test',(req,res)=>{
    console.log(`URL : ${req.originalUrl}`);
    if(req.url=='/test'){
        res.writeHead(200);
        res.end();
    }else{
        res.writeHead(404);
        res.end();
    }
})

result

URL : /test
GET /test 200 - - 1.761 ms
URL : /test
GET /test 200 - - 0.612 ms

1 Answers1

0

This is one way of preventing it, By blocking the request from the network tab in dev tools. enter image description here

NandaSagar
  • 11
  • 4