2013-05-22 21 views
6

Vorrei Nginx inviare la domanda tipo di contenuto/xml per tutti la risposta di una posizione:Nginx predefinita tipo di contenuto

La mia configurazione è la base sulla documentazione 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 
    } 
    } 

Ma la il server invia sempre come tipo di contenuto "text/xml". Qualche idea?

+0

Se l'URL termina con ".xml" provare a forzare il 'application/xml' per tipo XML all'interno tipi' tipi {applicazione XML/xml; } ' –

+0

Domanda stupida, ma ti manca un punto e virgola nella configurazione dopo la riga' default_type'? – Slartibartfast

risposta

2

Il tipo predefinito per l'estensione xml è text/xml. Questo comportamento è descritto nel file mime.types. Utilizzare http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type o http://nginx.org/en/docs/http/ngx_http_core_module.html#types per sovrascriverlo (impostare su application/xml).

Soluzione per 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

Ho provato questo come spiegato nella mia domanda ma non sembra funzionare – wonzbak

+0

Penso che problema nella configurazione del server back-end. Per Apache (httpd.conf) disabilitare DefaultType: DefaultType None –

Problemi correlati