Skip to content

Commit 96af484

Browse files
fmountclaude
authored andcommitted
Fix client IP logging in Watcher API VirtualHost
Align watcher httpd logging with the cinder/nova-operator pattern: - Add missing SetEnvIf X-Forwarded-For in the VirtualHost block - Normalize server-level httpd.conf: use standard LogFormat names (combined, proxy), fix inverted env= on proxy CustomLog, log to /dev/stdout so logs are visible via oc logs -f Closes: OSPRH-32126 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 5f64594 commit 96af484

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

templates/watcherapi/config/10-watcher-wsgi-main.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
## Logging
2222
ErrorLog /dev/stdout
2323
ServerSignature Off
24+
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
2425
CustomLog /dev/stdout combined env=!forwarded
2526
CustomLog /dev/stdout proxy env=forwarded
2627
## set watcher log level to debug

templates/watcherapi/config/httpd.conf

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ AccessFileName .htaccess
3636
Include "/etc/httpd/conf.modules.d/*.conf"
3737
Include "/etc/httpd/conf.d/*.conf"
3838

39-
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
40-
LogFormat "%a %l %u %t \"%r\" %>s %b" common
41-
LogFormat "%{Referer}i -> %U" referer
42-
LogFormat "%{User-agent}i" agent
43-
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" forwarded
44-
45-
ErrorLog /dev/stderr
46-
TransferLog /dev/stdout
39+
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
40+
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
41+
42+
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
43+
ErrorLog /dev/stdout
4744
CustomLog /dev/stdout combined env=!forwarded
48-
CustomLog /dev/stdout proxy env=!forwarded
45+
CustomLog /dev/stdout proxy env=forwarded
4946
## set default apache log level to infor from warning
5047
LogLevel info

0 commit comments

Comments
 (0)