Nginx proxy에서 client IP를 backend에 전달하기

2024. 12. 29. 20:00Web Server/nginx

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name www.test.co.kr;

    client_max_body_size 0;

    location / {
        proxy_pass http://spring-boot-service;

        # Forward headers
        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;
    }
}