nginx.conf
| 1 |
events {}
|
|---|---|
| 2 |
|
| 3 |
http {
|
| 4 |
upstream backend_servers {
|
| 5 |
server FWD_server:7443; |
| 6 |
} |
| 7 |
|
| 8 |
server {
|
| 9 |
listen 7443; |
| 10 |
|
| 11 |
location / {
|
| 12 |
proxy_pass https://backend_servers; |
| 13 |
|
| 14 |
# --- Standard Proxy Headers (Sent to App) --- |
| 15 |
proxy_set_header Host $host; |
| 16 |
proxy_set_header X-Real-IP $remote_addr; |
| 17 |
|
| 18 |
# --- NEW: Custom Response Header (Sent to User) --- |
| 19 |
# This adds a header named 'X-Server-IP' to the response you receive. |
| 20 |
# $upstream_addr holds the IP:Port of the actual container that served the request. |
| 21 |
add_header X-Server-IP $upstream_addr always; |
| 22 |
} |
| 23 |
} |
| 24 |
} |