Skip to content

Comments

[AAP-65701] Add nginx log markers for direct API access detection#318

Merged
jamesmarshall24 merged 3 commits intoansible:mainfrom
TheRealHaoLiu:AAP-65701/nginx-log-markers-and-route-removal
Feb 17, 2026
Merged

[AAP-65701] Add nginx log markers for direct API access detection#318
jamesmarshall24 merged 3 commits intoansible:mainfrom
TheRealHaoLiu:AAP-65701/nginx-log-markers-and-route-removal

Conversation

@TheRealHaoLiu
Copy link
Member

What is being changed?

Add nginx log markers to all three EDA nginx config templates to enable detection of direct component access vs gateway-proxied requests:

  • eda-api.configmap.yaml.j2 (API server nginx)
  • eda-event-stream.configmap.yaml.j2 (Event stream nginx)
  • eda.configmap.yaml.j2 (UI nginx)

Why is this change needed?

As part of ANSTRAT-1840 (Remove direct API access to platform components in AAP 2.7), we need visibility into whether requests to EDA are arriving through the AAP gateway (with X-Trusted-Proxy and X-DAB-JW-TOKEN headers) or directly.

The nginx log markers allow operators to detect and audit direct component access using log analysis tools.

How does this change address the issue?

Each nginx config template now includes:

  • map directives that detect the presence of X-Trusted-Proxy and X-DAB-JW-TOKEN headers
  • A log_format that appends rid=$request_id, $trusted_proxy_present, and $dab_jwt_present markers
  • Explicit access_log /dev/stdout main; and error_log /dev/stderr warn; for consistent logging

The upstream default ingress_type: none is already correct for AAP deployments (no direct routes created).

Does this change introduce any new dependencies, blockers or breaking changes?

No new dependencies. This is additive to the log format. Compatible with PR #317 (AAP-65231) which also adds rid=$request_id and stdout/stderr logging.

How it can be tested?

  1. Deploy EDA with the operator
  2. Check nginx access logs for the new marker fields
  3. Requests through the gateway should show trusted-proxy dab-jwt
  4. Direct requests should show - -

Relates-to: AAP-65701, ANSTRAT-1840

@TheRealHaoLiu TheRealHaoLiu force-pushed the AAP-65701/nginx-log-markers-and-route-removal branch from 4b242c4 to c34c681 Compare February 12, 2026 20:13
@jamesmarshall24 jamesmarshall24 self-requested a review February 16, 2026 19:06
@jamesmarshall24
Copy link
Contributor

This PR is broken, fixed with:
TheRealHaoLiu#1

Add map directives for X-Trusted-Proxy and X-DAB-JW-TOKEN headers to all
three nginx config templates (eda-api, eda-event-stream, eda-ui). These
markers allow detection of direct component access vs gateway-proxied
requests in nginx access logs.

Changes to all nginx configs:
- Add map directives to detect trusted-proxy and dab-jwt headers
- Add log_format with rid=$request_id and marker variables
- Set access_log to /dev/stdout with main format
- Set error_log to /dev/stderr with warn level
- Remove per-location log file directives in favor of http-level config

The upstream default ingress_type is already 'none' so no route removal
changes are needed in defaults.

Relates-to: AAP-65701, ANSTRAT-1840
@TheRealHaoLiu TheRealHaoLiu force-pushed the AAP-65701/nginx-log-markers-and-route-removal branch from c34c681 to e53c1a9 Compare February 17, 2026 22:02
@TheRealHaoLiu TheRealHaoLiu changed the title [AAP-65701] Add nginx log markers and remove direct routes for EDA [AAP-65701] Add nginx log markers Feb 17, 2026
The event-stream nginx config previously included req_len=$request_length
in its log_format for debugging event-stream payloads. This was
inadvertently dropped when adding the proxy detection markers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link

@TheRealHaoLiu TheRealHaoLiu changed the title [AAP-65701] Add nginx log markers [AAP-65701] Add nginx log markers for direct API access detection Feb 17, 2026
@jamesmarshall24 jamesmarshall24 merged commit d22e21b into ansible:main Feb 17, 2026
5 checks passed
@TheRealHaoLiu TheRealHaoLiu deleted the AAP-65701/nginx-log-markers-and-route-removal branch February 17, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants