So today at work I ran into a strange problem. An application I was writing had a JavaScript file named form.sales.var.js
, placed in the same directory as other JS files. However, when the browser tried to load the JS file, the server returned a 500 Internal Server Error
page. The Apache log showed the entry:
Syntax error in type map, no ':' in /var/www/...
—followed by the rest of the file path and the file's contents.
I did some research on Google regarding the issue and found that this was likely caused by the filename containing .var.
, causing Apache to treat it as a type-map. Since it wasn't, a syntax error occurs.
My questions now are:
- Why is a
.js
file being treated as a type-map when the documentation says that type maps are*.var
files? Is it just that my web server is misconfigured, or can others test to see if their web servers produce the same errors with files namedsomething.var.something
? - Why is there no documentation of this problem, and why is it so rarely reported, even though this behavior seems to have existed since Apache 1.3? It seems like it would be a more common issue.
- Are type-maps commonly used? Is there any foreseeable issues with disabling them in Apache?
- What is the best way to address this issue (aside from renaming the file and not using any filenames that contain
.var.
)?