Skip to content

Preserve HTTPS pagination links behind trusted proxies - #2495

Open
Prachi194agrawal wants to merge 1 commit into
aboutcode-org:mainfrom
Prachi194agrawal:fix/2399-preserve-forwarded-proto
Open

Prachi194agrawal wants to merge 1 commit into
aboutcode-org:mainfrom
Prachi194agrawal:fix/2399-preserve-forwarded-proto

Conversation

@Prachi194agrawal

Copy link
Copy Markdown

Fixes #2399

When an outer proxy terminates HTTPS and forwards the request over HTTP, the bundled Nginx overwrites X-Forwarded-Proto with its own connection scheme. Django then generates http:// URLs in the next and previous fields of the v3 packages and advisories responses.

This change lets the bundled Nginx preserve http or https from an explicitly trusted immediate proxy. For untrusted peers or missing or invalid headers, it uses its own connection scheme.

The installation guide explains how to add the immediate proxy’s IP address or CIDR to the trust list and configure that proxy to overwrite client-supplied headers. The trust list starts empty, so the public deployment needs to configure it for its proxy chain.

Testing

Added pagination unit tests and local Nginx integration tests covering HTTP and HTTPS on both v3 endpoints, including spoofed, missing, and invalid headers. CI installs Nginx and OpenSSL to run the integration tests.

NGINX_BINARY="$PWD/.cache/nginx-test/usr/sbin/nginx" \
  venv/bin/python -m pytest \
  vulnerabilities/tests/test_nginx_proxy.py --reuse-db -q

16 passed, 7 warnings.
Screenshot from 2026-11-11 23-16-22

Fixes aboutcode-org#2399

Signed-off-by: Prachi Agrawal <prachi194agrawal@gmail.com>

This branch has not been deployed

No deployments
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.

Paginated v3 API responses return http:// next/previous links on the public instance

1 participant