2013-05-22 29 views
6

bir konuma ilişkin tüm yanıtı için içerik türü uygulama/xml gönderin:Nginx varsayılan içerik türü

server { 

     server_name my_name 
     listen 8088; 
     keepalive_timeout 5; 

     location/{ 
     proxy_pass http://myhost; 

     types   { } 
     default_type application/xml 
    } 
    } 

Ama:

Benim yapılandırma belgelerinde http://wiki.nginx.org/HttpCoreModule#types üzerinde temelidir Sunucu her zaman içerik türü "metin/xml" olarak gönder. Herhangi bir fikrin var mı?

+0

Url'nizde ".xml" ile biterse tipleri 'türleri {xml application/xml içindeki xml türü için' uygulama/xml' zorlamayı deneyin; } ' –

+0

Silly soru, ama 'default_type' satırından sonra yapılandırmada noktalı virgül eksik? – Slartibartfast

cevap

2

xml uzantısı için varsayılan tür metin/xml'dir. Bu davranış mime.types dosyasında açıklanmıştır. Geçersiz kılmak için http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type veya http://nginx.org/en/docs/http/ngx_http_core_module.html#types kullanın (uygulama/xml olarak ayarlayın). apache httpd için

Çözüm:

# 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

Bu soruyu açıkladığım gibi denedim ama çalışmaz – wonzbak

+0

arka plan sunucu yapılandırmanızda sorun var. Apache için (httpd.conf) DefaultType'ı devre dışı bırakın: DefaultType Yok –

İlgili konular