Why do some browsers double-request all pages on my ASP.Net website?

Firefox issues duplicate requests to my ASP.Net website. He will request a page, receive a response, and then immediately repeat the same request (well, almost the same - see below). This happens on every page of this website (but not on the others). IE does not do this, but Chrome also does this.

I confirmed that there is no location header in the response and there is no Javascript or meta tag on the page that would force the page to re-request (if this were true, IE would request the pages again as well).

I have confirmed this behavior on multiple Firefox installations on multiple computers. Versions are changing, but they are all 3.x.

The only difference between the two requests is the Accepts header. For the first request, it looks like this:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 

For the second request, it looks like this:

 Accept: */* 

Content response header in all cases:

 Content-Type: text/html; charset=utf-8 

Something else strange - although Firefox requests the page twice, it uses the first response and discards the second. I put a counter on a page that increments with every request. I can watch how responses are returned (via Charles proxy). Firefox will get “1” for the first time, and “2” for the second time. However, for some reason it will show "1".

Chrome shows the same behavior. I suspect this is a protocol level issue, given the difference in the Accepts header, but I've never seen this before.

+4
source share
1 answer

Make sure you don't have img tags with empty src attributes.

FireFox (and apparently Safari and Chrome) interprets this as a site request, giving you a duplicate of the request.

There is a Mozilla support request about this, and a good article here discusses what each browser (and each version) does in this scenario.

+10
source

Source: https://habr.com/ru/post/1305095/


All Articles