Questions tagged [mime-type]
71 questions
18
votes
3 answers
How can I make sure that Nginx serves plaintext files as a download, instead of inline?
I have Rails application (Redmine) which works with Nginx. If I am clicking on any attachment my browser (firefox, ie, chrome) ask me to download file. But if I am clicking on txt-type attachment my browser open this file in the browser.
As I…
![](../../users/profiles/61755.webp)
ceth
- 506
- 1
- 7
- 16
9
votes
2 answers
Can I alias all directory requests to a single file in nginx?
I'm trying to figure out how to take all requests made to a particular directory and return a json string without a redirect, in nginx.
Example:
curl -i http://example.com/api/call1/
Expected result:
HTTP/1.1 200 OK
Accept-Ranges:…
![](../../users/profiles/88726.webp)
user749618
- 193
- 1
- 5
9
votes
3 answers
nginx, x-accel-redirect and mime types
In my nginx 0.8.34 setup I'm using the X-Accel-Redirect feature to control file downloads in the application code while not having the application handle the download itself.
After much pain this now basically works except nginx always returns the…
![](../../users/profiles/57488.webp)
Tomas Kohl
- 193
- 1
- 5
7
votes
1 answer
nginx how to override/add single mime-type
I tried to add markdown rendering by putting
types { text/markdown md; }
into server section, but then index.html stopped to be rendered all of a sudden. I can explain this only if types overrides the whole set of mime types for this section.
So,…
![](../../users/profiles/234580.webp)
anatoly techtonik
- 263
- 1
- 3
- 12
7
votes
3 answers
How can I define a mime type in nginx for tar.bz2 or tar.gz files?
I tried adding these lines to mime.types:
application/x-gtar tar.gz tgz tar.bz2 tbz2 tbz;
application/x-bzip2 bz2;
application/x-gzip gz;
But nginx reports "Content-Type: application/x-bzip2" for a tar.bz2 file. How can I fix it?
Additional…
![](../../users/profiles/42288.webp)
aditsu
- 386
- 4
- 10
5
votes
1 answer
Insert MIME type of an URL into Apache's access_log
I would like to enhance my logfile with an additional field containing the mime type.
E.G.
127.0.0.1 - - [01/Mar/2012:20:49:36 +0100] "GET / HTTP/1.1" 200 255 [...] "text/html"
127.0.0.1 - - [01/Mar/2012:20:49:37 +0100] "GET /x.gif HTTP/1.1" 200…
![](../../users/profiles/65736.webp)
mawimawi
- 400
- 3
- 6
- 17
5
votes
1 answer
What MIME type should I put for Windows shortcut file (.URL)
If I want to have a Windows shortcut file (foo.URL) to be saved for the users, what MIME type should I assign for it?
Default text/plain causes Windows to suggest it to be saved with .txt added as default.
With googling, I've found some…
![](../../users/profiles/75821.webp)
Touko
- 241
- 3
- 7
5
votes
1 answer
Apache treating files with ".var[.]" in their names as type-maps
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…
![](../../users/profiles/46027.webp)
Lèse majesté
- 359
- 1
- 2
- 11
4
votes
2 answers
How to set different mod_mime rules for reverse proxy?
By default, httpd contains the following configuration:
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
…
![](../../users/profiles/15584.webp)
Gili
- 295
- 1
- 4
- 20
4
votes
2 answers
What is AddType application/x-httpd-php-source
I have Apache 2.0, PHP 5.2.4, and this directive in the httpd.conf:
AddType application/x-httpd-php-source .php .php3 .php4 .php5 .php6
AddType directive is used to maps the given filename extensions onto the specified content type. This is the…
![](../../users/profiles/53956.webp)
egor
- 41
- 1
- 1
- 3
4
votes
2 answers
Change type of all .xml file in a SVN repository
How can I change the type of all the files in a repository SVN who have the extension .xml from the type binary to the type text.
It means, is no more necessary to change the type of each file, one by one, but all files with extension .xml in a…
![](../../users/profiles/8316.webp)
taintedlove
- 195
- 2
- 7
3
votes
1 answer
Nginx not adding expires headers to fonts, not changing mime types
I have the following location block in my server block in /etc/sites-available/example.com:
location ~* \.(ttf|woff|woff2|eot|mp4|css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
and this under…
![](../../users/profiles/516915.webp)
geochanto
- 157
- 9
3
votes
2 answers
Mime type received as "text/html", server configured to send as "text/javascript"
Both firefox and chrome are showing that javascript files from my server are served as MIME type text/html. The javascript files have a .js extension.
First, mime_module is installed and active:
apachectl -M | grep mime
mime_magic_module…
![](../../users/profiles/98791.webp)
a coder
- 719
- 4
- 20
- 37
3
votes
3 answers
How to serve giziped text files with nginx
To save space we gzip all our logs and text files and these files are browsed by the user, but these files are downloaded instead of opened in the browser, I couldn't find a way to set mime-type text/plain for such files e.g. this does not…
![](../../users/profiles/3095.webp)
Anurag Uniyal
- 151
- 1
- 4
3
votes
1 answer
Nginx: serving files as text without having .txt appended to it
I have some .rb (Ruby script) files that I link to on my website.
By default, the browser just downloads them to the "Downloads" folder, as it does zip files.
I want the browser to treat it as text, so the Ruby script will show within the…
![](../../users/profiles/190903.webp)
lwood
- 65
- 1
- 5