Learn how to use the MimeFilter config.txt directive to process file types that EZproxy does not process by default.
MimeFilter directs EZproxy to process a given file type that EZproxy does not process by default. This can only be applied to a specific database stanza.
MimeFilter is a position-dependent config.txt file that must be included after the Title directive of a specific database stanza. It allows the EZproxy administrator or content provider to specify a particular file type that EZproxy should process, that it would not otherwise process by default.
- Syntax
-
MimeFilter mime-type URI-pattern [-] action
Where each of the following variables must be entered:
Variable |
Description |
Example(s) |
mime-type |
The mime type of object to apply URL rewriting rules to. |
application/json |
URI-pattern |
URIs to apply URL rewriting to. This can be a PCRE regular expression. |
.* will match any URL
http://www.somedb.com/* will match any URL from the specified web server
.*\.js will match any URL that ends in .js
[^?]*\.js(\?.*)* will match any URL that ends in .js ignoring query string values
.* will match any URL
|
- (optional)
|
If this variable precedes the action variable, then remove default patterns for rewrite and ONLY consider these patterns for rewrite. |
- |
action |
Rewrite objects that match the above criteria that are embedded in Javascript, pdf, test, or HTML. |
Values can be:
javascript
pdf
test
html
If left blank an error is reported, and the directive is ignored.
|
EZproxy v6.1 and later
EZproxy v6.0.8 introduced default support for json rewriting. Content providers and resources requiring json applications to be rewritten should no longer require the MimeFilter directive; however, leaving the directive in stanzas that previously required it will do no harm.
- Example
- The following example would tell EZproxy to rewrite json applications in any URL (the *. means match any URL) embedded in the javascript.
MimeFilter application/json .* javascript
This is the most commonly-seen application of this directive in a database stanza.