카카오테크 부트캠프
[KTB-Final]nginx리버스 프록시 이슈(ai 서버에 전달되지 않는 오류)
아설아
2024. 11. 7. 10:53
/health가 아닌, //health로 전달되어 오류가 발생하는 것이었습니다.
location /ai {
rewrite ^/ai(/.*)$ $1 break;
proxy_pass http://10.0.27.137:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
rewrite구문을 넣어 줬습니다. 이렇게 하면 앞에있는 '/'이 빠지게 됩니다.
그 결과!
요청을 보내면 200 정상적인 메시지가 뜨는 것을 확인할 수 있다!