Skip to content

Commit e0ce3ef

Browse files
[AAP-64061] Add nginx log markers for direct API access detection (#2100)
Add map directives for X-Trusted-Proxy and X-DAB-JW-TOKEN headers to log the presence of these headers as trusted_proxy_present and dab_jwt_present fields in the nginx access log. These markers enable the detection tool (aap-detect-direct-component-access) to identify direct API access that bypasses AAP Gateway. Also add explicit error_log /dev/stderr warn; instead of relying on container base image symlinks. Part of ANSTRAT-1840: Remove direct API access to platform components. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fcf9a08 commit e0ce3ef

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

roles/installer/templates/configmaps/config.yaml.j2

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,23 @@ data:
111111
server_tokens off;
112112
client_max_body_size {{ nginx_client_max_body_size }}M;
113113

114+
map $http_x_trusted_proxy $trusted_proxy_present {
115+
default "trusted-proxy";
116+
"" "-";
117+
}
118+
119+
map $http_x_dab_jw_token $dab_jwt_present {
120+
default "dab-jwt";
121+
"" "-";
122+
}
123+
114124
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
115125
'$status $body_bytes_sent "$http_referer" '
116-
'"$http_user_agent" "$http_x_forwarded_for"';
126+
'"$http_user_agent" "$http_x_forwarded_for" '
127+
'$trusted_proxy_present $dab_jwt_present';
117128

118129
access_log /dev/stdout main;
130+
error_log /dev/stderr warn;
119131

120132
map $http_upgrade $connection_upgrade {
121133
default upgrade;

0 commit comments

Comments
 (0)