2012-08-05 3 views
1

Play Framework를 사용하여 웹 API를 개발 중입니다. 나는 리버스 프록시로 nginx를 사용한다. api는 임베디드 시스템에서 사용되므로 리턴 정보는 가능한 한 가볍게해야합니다. 생산 모드에서Nginx 및 원시 헤더

플레이 프레임 워크는 excatly이 반환 (RAW HTTP가 피들러에서 가져온 것입니다) 나는 사용자와 API 사이의 nginx를 배치 할 때

HTTP/1.1 200 OK 
Content-Type: text/plain; charset=utf-8 
Cache-Control: no-cache 
Content-Length: 14 

aTqYu1mxQPy|10 

그러나 응답이로 바뀝니다 :

HTTP/1.1 200 OK 
Server: nginx/1.2.0 
Date: Sun, 05 Aug 2012 15:08:31 GMT 
Content-Type: text/plain; charset=utf-8 
Content-Length: 14 
Connection: close 
Cache-Control: no-cache 

aTqYu1mxQPy|10 

필요 없음 서버, 날짜, 연결 헤더가 있습니다. nginx에 의해 자동으로 추가됩니다. (또는 내가 이전 실험에서 내 nginx 설정을 엉망으로 만들었 기 때문에)

ngnix에게 머리말을 말하지 말고 그대로 건네 주라고 말합니까?

답변

2

당신은 수정 (제거) 어떤 헤더를 nginx를 타사 모듈을 사용하여, https://github.com/agentzh/headers-more-nginx-module
을하지만 RFC 2616에 따라, HTTP 프로토콜에서 만 서버 헤더를 제거 할 수 있습니다.
연결 : 닫기 - 영구 (HTTP/1.1) 연결을 닫는 데 사용됩니다.
날짜 헤더는 이러한 경우를 제외하고, 모든 요청에 ​​HTTP/1.1에 제시해야합니다 : 내가 아는 한, nginx를 엄격하게 RFC에 다음

1. If the response status code is 100 (Continue) or 101 (Switching 
    Protocols), the response MAY include a Date header field, at 
    the server's option. 

    2. If the response status code conveys a server error, e.g. 500 
    (Internal Server Error) or 503 (Service Unavailable), and it is 
    inconvenient or impossible to generate a valid Date. 

    3. If the server does not have a clock that can provide a 
    reasonable approximation of the current time, its responses 
    MUST NOT include a Date header field 

.