nielsonm236 / NetMod-ServerApp

Reprogramming the Web_Relay_Con V2.0 HW-584 Network Module
71 stars 20 forks source link

Still seeing favicon.ico requests from Browsers #185

Closed nielsonm236 closed 11 months ago

nielsonm236 commented 12 months ago

All the code instrumentation added to investigate Issue #183 exposed that Browsers are still requesting favicon.ico image files. It appears that the request only occurs when a REST command that does not provide a webpage as a response is issued (for example /55, /56, /00, /01 etc). I had previously added this between the in the HTML which is widely discussed in Stack Overflow as a means of preventing Browsers from sending facicon.ico requests:

But it only works if there is a webpage response to a GET request. So ... it's not really solving the problem other than eliminating some HTTP traffic for some webpages. I think I'll have to explicitly filter the favicon.ico request, or document that command /fa can't be used. Maybe that is the better approach for now since we are unlikely to use up all the command space anyway. My only remaining concern is whether it is compliant to ignore the favicon.ico request (just letting it time out), as opposed to providing a 204 response.

nielsonm236 commented 11 months ago

The fix applied is to detect the favicon.ico request, and reply with a "200 OK" and "Content-Length:0". This tells the Browser there is no favicon.ico file.

nielsonm236 commented 11 months ago

Addressed in build 20230803 1943