• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Question Mime Type for Nginx

fliegerhermi

Regular Pleskian
Hi everyone.
A client wants to offer dxf files for download.
The file is always opened in the browser as text file.

I tried to add the mime types to the common apache settings mime-type section as described here: Apache and Nginx Settings

I put the following entry:
application/acad .dwg
application/dxf .dxf

It didn't help. The files are still opened in the browser. Are the directives also valid for nginx?

Thank you for your help
 
Hi Igor,
thank you for the quick reply.

The filetype in questions is dxf (not dfx) and dxf is included in the list.
Any other idea?
 
I tried to reproduce your problem but I couldn't. I took a plain Plesk server, default installation. I added a domain and created a file "test.dxf" and called the URL. Result: Browser wants to download the file.

Here are the headers of the HTTP response:
Code:
# curl -v -s http://my-test-domain.tld/test.dxf 1>/dev/null
> GET /test.dxf HTTP/1.1
> User-Agent: curl/7.29.0
> Host: my-test-domain.tld
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Thu, 22 Jul 2021 07:34:09 GMT
< Content-Type: image/vnd.dxf
< Content-Length: 5
< Connection: keep-alive
< X-Accel-Version: 0.01
[...]

So default content-type is "image/vnd.dxf".

Next, I added the following to "Apache & nginx settings" at "Mime types" => "Custom value":
Code:
application/dxf .dxf

Result: The content-type has changed and the browser still wants to download the file:
Code:
# curl -v -s http://my-test-domain.tld/test.dxf 1>/dev/null
> GET /test.dxf HTTP/1.1
> User-Agent: curl/7.29.0
> Host: my-test-domain.tld
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Thu, 22 Jul 2021 07:34:13 GMT
< Content-Type: application/dxf
< Content-Length: 5
< Connection: keep-alive
< X-Accel-Version: 0.01
[...]

Do you have any other custom settings? Maybe there is an .htaccess file that overrides some settings?
 
Back
Top