nginx - handling Post request which returns excel -


i using ngnix proxy_pass request app server. using below configuration

server {   listen       80;   server_name  localhost;   access_log  /var/log/nginx/localhost.access.log;   location / {              proxy_pass http://localhost:9000;              proxy_http_version 1.1;              proxy_set_header upgrade $http_upgrade;              proxy_set_header connection 'upgrade';              proxy_set_header host $host;              proxy_cache_bypass $http_upgrade;             }   location /names.json {     proxy_pass      http://appserver.com:3000;   }   location /names/ {     proxy_pass      http://appserver.com:3000;   } } 

now have post request in format: http://uiserver.com/hosts/export.xlsx

i passing params post , making post request web server. when app server returns data in form of excel, browser not loading data in form of file instead, seeing encrypted data in response.

is there missing , how should fix this? or form app server end. please let me know.

thanks

the browser use content-type header know content (and how handle it). application should send content-type: application/<mimetype of document>, see this question correct types.

without (or incorrect one), browser may try display content text.


Comments