NGINX 학습 노트 - 전달 요청 헤드
기본적으로 NGINX 는 프 록 시 요청 시 HTTP 헤드 필드 두 개 를 'Host' 와 'Connection' 으로 다시 정의 하고 값 이 비어 있 는 헤드 필드 를 삭제 합 니 다.'Host' 는
$proxy_host
변수의 값 으로, 'Connection' 은 close 로 설정 된다.By default, NGINX redefines two header fields in proxied requests, “Host” and “Connection”, and eliminates the header fields whose values are empty strings. “Host” is set to the $proxy_host variable, and “Connection” is set to close. 이 설정 을 변경 하려 면 다른 헤드 필드 를 수정 하고
proxy_set_header
명령 을 사용 하 십시오.이 명령 은 location
또는 더 높 은 층 에서 사용 할 수 있다.특정한 server
컨 텍스트 나 http 블록 에서 도 가능 합 니 다. 예 를 들 어 To change these setting, as well as modify other header fields, use the proxyset_header directive. This directive can be specified in a location or higher. It can also be specified in a particular server context or in the http block. For example: location /some/path/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8000;
}
이 설정 에서 "Host" 필드 는
$host
변수 로 설정 되 었 습 니 다.In this configuration the “Host” field is set to the $host variable. 프 록 시 서버 에 헤더 필드 가 전달 되 는 것 을 막 으 려 면 빈 문자열 로 설정 하 십시오.To prevent a header field from being passed to the proxied server, set it to an empty string as follows:
location /some/path/ {
proxy_set_header Accept-Encoding "";
proxy_pass http://localhost:8000;
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
NGINX 학습 노트 - 전달 요청 헤드기본적으로 NGINX 는 프 록 시 요청 시 HTTP 헤드 필드 두 개 를 'Host' 와 'Connection' 으로 다시 정의 하고 값 이 비어 있 는 헤드 필드 를 삭제 합 니 다.'Host' 는 $proxy_...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.