我想Nginx发送内容类型的application / xml
对于某个位置的所有响应:
我的配置基于文档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
}
}
@H_502_10@
但是服务器总是以内容类型“text / xml”发送.
任何的想法?
最佳答案
xml扩展名的默认类型是text / xml. mime.types文件中描述了此行为.使用http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type或http://nginx.org/en/docs/http/ngx_http_core_module.html#types覆盖它(设置为application / xml).
原文链接:https://www.f2er.com/nginx/434811.htmlapache解决方案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
@H_502_10@
http://httpd.apache.org/docs/current/mod/core.html#defaulttype