You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by howard chen <ho...@gmail.com> on 2009/10/07 17:19:34 UTC

[users@httpd] application/x-javascript vs application/javascript

Hello,

Why in some Apache httpd, JavaScript is sent by Content Type =
application/x-javascript, but some httpd is application/javascript?

Both are 2.2.


Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] application/x-javascript vs application/javascript

Posted by Tom Evans <te...@googlemail.com>.
On Wed, 2009-10-07 at 23:19 +0800, howard chen wrote:
> Hello,
> 
> Why in some Apache httpd, JavaScript is sent by Content Type =
> application/x-javascript, but some httpd is application/javascript?
> 
> Both are 2.2.
> 
> 
> Thanks.
> 

The mime type of a file sent from disk is determined by apache using the
file extension and looking it up in the mime.types file referenced in
the apache config with the directive TypesConfig[1], which defaults to
'conf/mime.types', relative to the ServerRoot.

In the stock apache mime.types, .js files are configured as such:
> $ egrep js$ /usr/local/etc/apache22/mime.types 
application/javascript				js

If you are getting a different mime-type, then that is because either
your mime.types file has a different setting, or it is being overridden
with an explicit
	AddType application/x-javascript .js

Cheers

Tom

[1] http://httpd.apache.org/docs/2.2/mod/mod_mime.html#typesconfig
[2] http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org