2013-01-02 3 views
0

nginx 뒤에있는 노드 js (express js)를 사용하는 웹 응용 프로그램 빌드가 있습니다.nginx 뒤에 노드 응용 프로그램이있는 콘텐츠 유형 응답 헤더

특정 API의 경우 콘텐츠 형식 응답 헤더를 "text/plain"으로 지정하려고합니다. 이 코드는 컨트롤러에 있습니다.

res.setHeader ('Content-Type', 'text/plain'); res.send (응답);

이것은 서버가 nginx 뒤에 있지 않을 때 작동합니다.

#kZyguser www-data; 
user root; 
worker_processes 4; 
pid /var/run/nginx.pid; 

events { 
     worker_connections 20000; 
     # multi_accept on; 
} 

http { 

     ## 
     # Basic Settings 
     ## 

     sendfile on; 
     tcp_nopush on; 
     tcp_nodelay on; 
     keepalive_timeout 65; 
     types_hash_max_size 2048; 
     # server_tokens off; 

     # server_names_hash_bucket_size 64; 
     # server_name_in_redirect off; 

     include /etc/nginx/mime.types; 
     default_type application/octet-stream; 

     ## 
     # Logging Settings 
     ## 
     access_log /var/log/nginx/access.log; 

답변

1

당신의 nginx에서 proxy_pass_header를 사용하여 시도 유무 : 서버의 nginx 뒤에 때, 응답 헤더는 '응용 프로그램/JSON'

의 nginx 구성이 아래에 붙여 아직도?

http://wiki.nginx.org/HttpProxyModule

proxy_pass_header Content-Type;

은 BTW - 당신의 문제가 완전하지 않을 수 있습니다 귀하의 nginx 구성처럼 보인다.