From 86fa13902aca10b63cb615d67e9c2484291b6770 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Mon, 29 Jun 2026 15:15:55 +0200 Subject: [PATCH] Fix client IP logging in Glance API VirtualHost The VirtualHost CustomLog directive was overriding the server-level dual-log setup, causing all requests to be logged with the OpenShift router IP instead of the real client IP from X-Forwarded-For. Add SetEnvIf and dual CustomLog lines inside the VirtualHost block to match the nova-operator pattern. Closes: OSPRH-32106 Co-Authored-By: Claude Opus 4.6 Signed-off-by: Francesco Pantano --- templates/common/config/10-glance-proxypass.conf | 4 +++- templates/common/config/10-glance-wsgi.conf | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/common/config/10-glance-proxypass.conf b/templates/common/config/10-glance-proxypass.conf index 21f4ad128..c6ae3e0a5 100644 --- a/templates/common/config/10-glance-proxypass.conf +++ b/templates/common/config/10-glance-proxypass.conf @@ -7,7 +7,9 @@ ## Logging ErrorLog /dev/stdout ServerSignature Off - CustomLog /dev/stdout combined + SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded + CustomLog /dev/stdout combined env=!forwarded + CustomLog /dev/stdout proxy env=forwarded ## Request header rules ## as per http://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader diff --git a/templates/common/config/10-glance-wsgi.conf b/templates/common/config/10-glance-wsgi.conf index 837f3b473..3823c267b 100644 --- a/templates/common/config/10-glance-wsgi.conf +++ b/templates/common/config/10-glance-wsgi.conf @@ -20,7 +20,9 @@ ## Logging ErrorLog /dev/stdout ServerSignature Off - CustomLog /dev/stdout combined + SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded + CustomLog /dev/stdout combined env=!forwarded + CustomLog /dev/stdout proxy env=forwarded {{- if $vhost.TLS }} SetEnvIf X-Forwarded-Proto https HTTPS=1