728x90
목차
1. 개요
client request → gateway → nginx → was server 과정으로 요청이 인입되고있습니다.
하지만 gateway에서 nginx 로 커스텀 헤더가 인입되지 않는 이슈가 발생하였습니다.
2. nginx 와 underscroes_in_headers
nginx 에서 커스텀 헤더가 인입되지 않는 이유와 해결책을 아래와 같습니다.
- 기본적으로 nginx 는 http 헤더의 언더스코어 (_) 를 제거한뒤 springboot server 로 전달합니다.
- 따라서 가급적이면 헤더에 언더스코어를 포함하지 않도록 정의하여 사용합니다.
- x-custom-header (o)
- x_custom_header (x)
3. 해결방법
- 언더스코어가 포함된 헤더를 사용하기위해서 아래와 같이 nginx.conf 에 설정을 추가해줍니다.
- nginx.config
server {
underscores_in_headers on; //추가된 부분
}
4. 참고자료
https://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers
728x90
'스터디 > JAVA' 카테고리의 다른 글
[Nginx] Server Keepalive와 Upstream Keepalive (0) | 2025.01.26 |
---|---|
[JAVA] gson에서 Deserialize, Serialize, TypeAdaptor 적용하기 (1) | 2025.01.22 |
[JAVA] 타임존 알아보기 Instant, LocalDateTime, ZonedDateTime (0) | 2024.07.02 |
[JAVA] enum 비교는 equals 일까 == 일까? (1) | 2024.04.28 |
[JAVA] Junit InvalidTestClassError 오류 원인과 해결 방법 (0) | 2024.01.29 |