Koozali.org: home of the SME Server

Adding MIME type to server?

Offline chris burnat

  • ****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Adding MIME type to server?
« on: October 27, 2007, 02:41:19 PM »
I need to add MIME types to an sme7.2 server to facilitate the use of *.asx files in the context of an html page used for streaming WMA encoded content. I have tried:
Code: [Select]
[root@test1 conf]# mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
[root@test1 conf]# cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

pico 75AddType01video.asx

[and added the following:]
#add mime support for asx files
AddType video/x-ms-asx .asx
AddType video/x-ms-asf .asx

[root@test1 httpd.conf]# expand-template /etc/httpd/conf/httpd.conf
[root@test1 httpd.conf]# /etc/rc7.d/S86httpd-e-smith restart
Restarting httpd-e-smith                                   [  OK  ]

The lines have been added to httpd.conf. Unfortunately the *.asx files I use to control the player at various bitrates are not loading.  I suspect that the MIME types have not been added correctly. 

Is this the correct way of adding MIME types to the server?
Is there a way to find out which MIME types the server support?

Thanks for any pointers, I am lost...

(Edited: spellos]
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline mmccarn

  • *
  • 2,627
  • +10/-0
Re: Adding MIME type to server?
« Reply #1 on: October 27, 2007, 05:31:17 PM »
Here's a quote from Experts-Exchange:
Problem:
When placing .asx, .asf, .wma, and .wax files on a Web server
it is necessary to change the Web server's MIME type so that
client Web browsers understand how to handle these files. If no
MIME type is set for these file types, the MIME type sent from
the Web server to the browser is by default text/html, and that
is incorrect. This can cause your .asx or .wax files to show in
the browser window instead of starting the Windows Media Player.

Steps to set up Windows Media MIME types for Apache:
----------------------------------------------------

Step 1) Make sure you have server administration privileges.

Step 2) Change the folders to <apache_root>/httpd/conf. Edit the
        Srm.conf file.

Step 3) Add the following lines of code to the end of the file,
        or to the same location as the other AddType video/*
        entries.

AddType video/x-ms-asf asf asx
AddType audio/x-ms-wma wma
AddType audio/x-ms-wax wax

NOTE: If you add these lines to the end of the file, make sure
the file ends with a blank line.

Step 4) Save your changes and close the editor.

Step 5) Restart the Web server.

If you still have the problem, post your srm.conf and the
behavior

I also found a sample mime.types file that includes 'asf' and 'asx' extensions:
# various Micro$oft extensions
video/x-ms-asf          asf asx
video/x-ms-wm          wm
video/x-ms-wmv          wmv
video/x-ms-wmx          wmx
video/x-ms-wvx          wvx

Both of these define only *one* new mime-type video/x-ms-asf and then assign it to both asf and asx.


Offline chris burnat

  • ****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Re: Adding MIME type to server?
« Reply #2 on: October 28, 2007, 04:02:45 AM »
Thanks for your reply mmccarn. My problem was that during the battle taking place over past 24 hours with MS applications (#$!!&*!), I had somehow corrupted the ASX files... There is also a fair amount of confusion with the syntax of MIME extensions, i.e. whether  the extension itself should be preceded by a dot or not (AddType video/x-ms-asf asf asx versus AddType video/x-ms-asf .asf .asx).  After fixing my *.asx files I ended up adding the following using the template method outlined in my first post:

Code: [Select]
[root@test1 httpd.conf]# cat 75AddType01video.asx
#add mime support for asx files
AddType video/x-ms-asf .asx .asf
AddType application/x-mplayer2 .asx
AddType audio/x-scpls .pls
AddType audio/mpeg .mp3
AddType audio/x-mpegurl .m3u
AddType audio/x-ms-wma .wma
AddType audio/x-ms-wax .wax
AddType video/x-ms-wmv .wmv
AddType video/x-ms-wvx .wvx
AddType video/x-ms-wmx .wmx
AddType application/ogg .ogm
AddType application/ogg .ogg

A bit of an overkill, but will get me ready to stream other formats later on.
All is well now.

- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Adding MIME type to server?
« Reply #3 on: October 28, 2007, 08:31:22 AM »
There is also a fair amount of confusion with the syntax of MIME extensions, i.e. whether  the extension itself should be preceded by a dot or not (AddType video/x-ms-asf asf asx versus AddType video/x-ms-asf .asf .asx).
It is such a nicre thing to have manual ;-) as the AddType directive instruction in the Apache manual states:
The extension argument is case-insensitive, and can be specified with or without a leading dot.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline chris burnat

  • ****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Re: Adding MIME type to server?
« Reply #4 on: October 28, 2007, 11:19:20 AM »
Thanks Cactus, I am now wiser and in peace. 
Good information
Regards
chris
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.