nginx
proxy_pass 사용할 때 유의사항 - Host
'김용환'
2017. 2. 2. 10:42
nginx 설정에서
nginx->java(tomcat, jetty, netty)로 사용하는 reverse proxy 구조에서는 Host 설정이 중요하지 않지만,
nginx->nginx 로 사용하는 reverse proxy 구조에서는 Host 설정이 중요하다. nginx에서는 Host 설정이 헤더로 들어오지 않으면 400 에러를 발생한다.(http://knight76.tistory.com/entry/nginx%EC%97%90-host-%ED%97%A4%EB%8D%94-%EC%97%86%EC%9D%B4-%EC%84%9C%EB%B9%84%EC%8A%A4-%EB%90%98%EA%B2%8C-%ED%95%98%EA%B8%B0)
예시
location ^~ /plus-image {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host plus.image.google.co.kr;
proxy_pass http://plus.image.google.co.kr/meta/;
}