awstats_misc_tracker.js and error 406

Developers
2004-10-01
2012-10-11
  • Gaetano Giunta
    Gaetano Giunta
    2004-10-01

    After enabling the js script to track client browser features, a few errors 406 start to pop-up here and there in the web server logs.

    Analysis: this is due to the js script writing to the html page an img tag that points back (via src) to the javascript file itself. Some browsers apparently request the js file specifying they accept only image MIME types - which is kinda logical, since it's an img tag -, and the web server (IIS 6) raises a 406 because it has an application/x-js to send instead.

    A workaround could be to change the variable "awstatsmisctrackerurl" in the js file to point to a real 1x1px image sitting on the server, and change accordingly the parameter in the .conf file.

    1 - is this correct (i.e. does the parameter in the conf file refer only to the 2nd hit appearing in the logs or it applies also to the 1st hit?)

    2 - if so, could this be done in the base awstats distribution?

    Thanks
    Gaetano Giunta