Skip to content

fix: ignore proxy_protocol listen sockets during api discovery (#978) - #1910

Open
devaniketh wants to merge 1 commit into
nginx:mainfrom
devaniketh:fix/proxy-protocol-listen-sockets
Open

devaniketh wants to merge 1 commit into
nginx:mainfrom
devaniketh:fix/proxy-protocol-listen-sockets

Conversation

@devaniketh

Copy link
Copy Markdown

Proposed changes

When NGINX is configured with listen ... proxy_protocol;, connecting to that socket requires an immediate PROXY protocol header. The agent's config parser previously created plain HTTP endpoint URLs for these sockets, causing NGINX connection resets (broken header: "GET /api HTTP/1.1" while reading PROXY protocol) and agent scraping failures (EOF).

This PR:

  • Detects the proxy_protocol parameter on listen directives via hasProxyProtocolArgument and isProxyProtocolListenDirective.
  • Excludes proxy_protocol listen sockets when generating plain HTTP endpoints for /stub_status and /api.
  • Allows mixed configurations (e.g. proxy_protocol on port 8888 and standard listener on port 8080 or unix socket) to discover the valid, reachable endpoint.
  • Adds table-driven unit tests for both mixed listeners and proxy_protocol-only listeners in nginx_config_parser_test.go.

Closes #978

Checklist

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes

@devaniketh
devaniketh requested a review from a team as a code owner September 1, 2026 08:55
@github-actions github-actions Bot added bug Something isn't working chore Pull requests for routine tasks labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

@devaniketh

Copy link
Copy Markdown
Author

I have hereby read the F5 CLA and agree to its terms

@devaniketh

Copy link
Copy Markdown
Author

recheck

@devaniketh

Copy link
Copy Markdown
Author

@aknot242 hey kindly check the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chore Pull requests for routine tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent fails to communicate with nginx listen sockets with proxy protocol enabled

1 participant