Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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:

  1. 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 named something.var.something?
  2. 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.
  3. Are type-maps commonly used? Is there any foreseeable issues with disabling them in Apache?
  4. What is the best way to address this issue (aside from renaming the file and not using any filenames that contain .var.)?
share|improve this question

1 Answer 1

up vote 2 down vote accepted

That's part of Apache httpd's Content Negotiation. Just remove the handler for type-map for the <Directory> or <Location> of your JavaScript files or remove MultiViews for these directories.

share|improve this answer
    
Would this likely impact compatibility with other software? I'd like to avoid removing default functionality if this is a commonly used feature. And is the behavior of matching "var" anyway in the filename instead of just the extension normal? –  Lèse majesté Jul 10 '10 at 12:55
1  
If you don't know if you're using MultiViews, you're probably not. I'd say it's safe to deactivate MultiVews for you. –  joschi Jul 10 '10 at 13:52
1  
Specifically you remove a handler for a file type in a directory with: <Directory /var/www/mydir> RemoveHandler .var </Directory> –  Jon Nov 24 at 19:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.