Skip to content

Commit f29a2fe

Browse files
authored
Merge pull request #242 from os2display/hotfix/ip-logging
1185: Ensured real ip is logged in nginx
2 parents 80bd7e7 + 1eaccb1 commit f29a2fe

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- [#242](https://github.com/os2display/display-admin-client/pull/242)
8+
- Ensured real ip is logged in nginx.
9+
710
## [2.0.1] - 2024-04-10
811

912
- [#241](https://github.com/os2display/display-admin-client/pull/241)

infrastructure/itkdev/etc/confd/templates/nginx.conf.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ http {
3434
include /etc/nginx/mime.types;
3535
default_type application/octet-stream;
3636

37-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
37+
set_real_ip_from 172.16.0.0/8;
38+
real_ip_recursive on;
39+
real_ip_header X-Forwarded-For;
40+
41+
log_format main '$http_x_real_ip - $remote_user [$time_local] "$request" '
3842
'$status $body_bytes_sent "$http_referer" '
3943
'"$http_user_agent" "$http_x_forwarded_for"';
4044

infrastructure/os2display/etc/confd/templates/nginx.conf.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ http {
3434
include /etc/nginx/mime.types;
3535
default_type application/octet-stream;
3636

37-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
37+
set_real_ip_from 172.16.0.0/8;
38+
real_ip_recursive on;
39+
real_ip_header X-Forwarded-For;
40+
41+
log_format main '$http_x_real_ip - $remote_user [$time_local] "$request" '
3842
'$status $body_bytes_sent "$http_referer" '
3943
'"$http_user_agent" "$http_x_forwarded_for"';
4044

0 commit comments

Comments
 (0)