I am developing a Java web application that involves the following technologies:
Apache Struts 2.x
Apache Tomcat 6.x (for development)
JSP/Tiles
JavaScript/JQuery
Firefox 3.5/Firebug 1.4
etc
Suddenly, running the application on my local environment, I notice that the browser complains about a JavaScript function not being defined. After taking a look at Firebug's JavaScript console I found out that the culprit was a file called dynamicPopup.js that, for whatever reason, was not being served by Tomcat. It was being returned to the browser as a 1px by 1px GIF image.
This is what I've got back when requesting it using curl on Cygwin:
* About to connect() to localhost port 8080 (#0) * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /scripts/dynamicPopup.js HTTP/1.1 > User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8j zlib/1.2.3 libssh2/0.15-CVS > Host: localhost:8080 > Accept: */* > < HTTP/1.1 200 OK < Cache-Control: max-age=1000 < Connection: close < Content-Language: en < Content-Length: 43 < Content-Type: image/gif < Server: kav/7.0 < * Closing connection #0 GIF89a? ? ? ÿÿÿ !ù?? , ? ? ??D? ;
After doing some reasearch I learned that "kav/7.0" stands for Kaspersky Antivirurus 7.0. This seemed familiar as I recently decided to switch from Norton Antivirus to Kaspersky Internet Security 2009 (which contains Kaspersky Antivirus 7.0). So I started to look in that direction and I came to the following conclusions:
The issue still happened after temporarily disabling Kaspersky's firewall.
The issue stopped happening after temporarily disabling ALL Kaspersky protection: antivirus, firewall, anti spyware, etc. So, dynamicPopup.js was back to being served by Tomcat as text/javascript.
Now, I had to understand which Kaspersky module was blocking that JavaScript file.
After trying changing different settings I found out that the misleadingly named Banner Ad Blocker was intercepting and blocking the request. It seems that the banner ad blocker doesn't like js files names which contain the word "popup".
Finally, the solution boiled down to adding white list rules which will instruct Kaspersky to trust any requests made to my local server(localhost or 127.0.0.1). These rules are:
*localhost*
*127.0.0.1*
One can access the banner ad blocker white listing rules screen by:
Protection > Content Filtering > Banner Ad Blocker > Settings... > Banner Ad Blocker Settings... > "White" list > + Add...
After this, everything came back to normal. Only one question remains:
What on Earth does a banner ad have to do with my JavaScript file?