Nginx Default Content Type

I would like NGINX to send a content type / xml application for the entire location response:

My configuration is based on the documentation http://wiki.nginx.org/HttpCoreModule#types :

server { server_name my_name listen 8088; keepalive_timeout 5; location / { proxy_pass http://myhost; types { } default_type application/xml } } 

But the server always sends content like "text / xml". Any idea?

+8
source share
1 answer

The default type for the xml extension is text / xml. This behavior is described in the mime.types file. Use http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type or http://nginx.org/en/docs/http/ngx_http_core_module.html#types to override it (for / xml application) .

Solution for apache httpd:

 # DefaultType: the default MIME type the server will use for a document # if it cannot otherwise determine one, such as from filename extensions. # If your server contains mostly text or HTML documents, "text/plain" is # a good value. If most of your content is binary, such as applications # or images, you may want to use "application/octet-stream" instead to # keep browsers from trying to display binary files as though they are # text. DefaultType None 

http://httpd.apache.org/docs/current/mod/core.html#defaulttype

0
source

Source: https://habr.com/ru/post/945574/


All Articles