Mittwoch, 5. Januar 2011

nginx: Blocking Mozilla Prefetch Requests

if ( $http_x_moz = "prefetch" ) {
return 444;
}
On ComputerBase they accounted for 15 % of all HTTP requests for HTML pages. And our HTML pages cannot even be cached so this behaviour of Mozilla browsers is a waste of resources (server load + traffic).

Mozilla should fix Firefox such that it only prefetches resources marked as rel="prefetch". Those marked as rel="next" should not be prefetched.

Edit: Switched from "return 403" to "return 444" (i.e. just close connection) because some users reported problems with proxy servers.