Page 1 of 1
Apache - Send Response Header Based On MIME
Posted: Thu Aug 30, 2007 4:09 am
by Ollie Saunders
I want to send a "Content-Disposition: attachment" response header if the file is a video; if it has a MIME of video/*. I can't see to find the appropriate Apache directive (using Apache 2.0.x) for this.
This directive:
Code: Select all
Header set "Content-Disposition" "attachment"
Sends the header fine but what can I use for the conditionality? <FileMatch> would work but isn't particularly nice.
Posted: Thu Aug 30, 2007 4:16 am
by VladSun
Would
http://httpd.apache.org/docs/2.2/mod/core.html#addoutputfilterbytype
be in use?
PS: Well, i don't think it is going to work on Apache < 2.1.+
Posted: Fri Aug 31, 2007 7:48 pm
by Ollie Saunders
PS: Well, i don't think it is going to work on Apache < 2.1.+
I'm 2.0.55 and this is available in 2.0.33 so we're good except for the fact that I don't think it's going to do what I want; unless I can define a filter that sends that header, but considering one example of a filter is deflate, I don't think filters will be able to do that.
Posted: Sun Sep 02, 2007 6:04 pm
by VladSun
Hm, maybe using
mod_ext_filter could be a solution?
Posted: Sun Sep 02, 2007 7:14 pm
by Ollie Saunders
I'm confused. How's that going to help?
Posted: Mon Sep 03, 2007 6:40 am
by VladSun
Indeed, I'm not sure it will help, but the
flow diagram suggests that you can manually add headers to response contents. I've never tried it but may be it is an option for you
Also, I think that
ExtFilterDefine Directive would be useful.