Skip to content

fix(proxy): handle trusted TLS termination without redirect loops - #90

Merged
RentnerKev merged 3 commits into
mainfrom
fix/trusted-tls-termination
Sep 12, 2026
Merged

RentnerKev merged 3 commits into
mainfrom
fix/trusted-tls-termination

Conversation

@RentnerKev

@RentnerKev RentnerKev commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix Force HTTPS loops when a configured TLS terminator forwards HTTP to RentnerProxy. The new, empty-by-default RENTNERPROXY_PROXY_TRUSTED_PROXY_CIDRS accepts narrow canonical IPv4/IPv6 networks. Only the direct socket peer and exactly one X-Forwarded-Proto: https value authorize the HTTPS path; upstream scheme headers are sanitized.

Retain 308 redirects, public HTTPS ports, methods and URIs, add Cache-Control: no-store, and keep ACME challenge routing first. Existing access-policy and Basic Auth checks remain enforced. Data-plane trust is separate from management-web trust. Caddy previews and production configuration use the same typed settings.

Related issue

Closes #79

Type of change

  • Bug fix
  • Documentation

Testing

  • bun run check: 752 web tests and 160 Rust tests passed; format, lint, types, migration validation and production builds passed.
  • bun run certificates:smoke: 44 checks passed, including a real TLS-terminating Caddy front proxy over HTTP/1.1 and HTTP/2, IPv4/IPv6 trusted peers, duplicate/comma/forged headers, method/path preservation, and ACME priority.
  • bun run production:smoke: 29 assertions passed, including Alpha 1 upgrade and restore recovery.
  • bun run proxy:smoke: 36 checks passed.
  • bun run upstream-tls:smoke: 11 checks passed.
  • Final HTTPS challenge-scheme correction: 17 focused renderer tests passed; format, lint and typecheck passed afterward.
  • Independent review covered direct-peer trust, ambiguous headers, configuration limits, and access-policy preservation.

Checklist

  • I tested the relevant functionality.
  • Existing tests pass.
  • I added or updated tests where appropriate.
  • This PR does not include secrets, credentials, production data, or private certificates/keys.
  • I updated documentation where necessary.
  • I linked the relevant issue for a feature or fix, or explained why no issue is needed.

Breaking changes

None. Trusted forwarding remains disabled unless explicitly configured. Invalid trust configurations fail startup.

Screenshots

None; no UI changes.

@RentnerKev RentnerKev added this to the v1.0.0-alpha.4 milestone Sep 12, 2026
@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8ad928fa-fbb8-4a26-87f6-3e50583b515a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area: runtime Caddy and privileged controller runtime behavior. area: docker Docker images, Compose configuration, and deployment. labels Sep 12, 2026
@RentnerKev
RentnerKev force-pushed the fix/trusted-tls-termination branch from e875efd to 520d5f4 Compare September 12, 2026 19:50
@github-actions

Copy link
Copy Markdown

🐳 RentnerProxy PR Preview

A test-only image for this pull request has been published successfully.

Images

Type Image
Moving preview for this PR ghcr.io/rentnerkev/rentnerproxy:pr-90
Exact tested build ghcr.io/rentnerkev/rentnerproxy:pr-90-d447c662b978

Image digest: sha256:4c6e16bd02520e11ea74add5d9a361e7ba0ab012301f524eecd2c8197d1744a2

Tested and built merge commit: d447c662b978cdcd6aa4df66753f6e075bf504d9

Pull request head commit: ca5078fda20e965414e26a24c9864bd34c0c4e5a

For reproducible testing and bug reports, prefer pr-90-d447c662b978. The pr-90 tag moves to the newest successful preview for this PR.


⚠️ Unreviewed development preview

This image contains unreviewed pull-request code. It may contain bugs, breaking changes, incomplete or incompatible migrations, configuration errors, and changes that damage data or runtime state.

Do not use this PR preview image with production data.

Before testing:

  1. Back up PostgreSQL.
  2. Back up the complete RentnerProxy controller/runtime state in /var/lib/rentnerproxy, including certificates, private keys, ACME state, active configuration, last-known-good state, and trusted CA material.
  3. Prefer a separate test database and separate Docker volumes.
  4. Use an isolated Docker Compose project and avoid production port bindings.

Docker

docker pull ghcr.io/rentnerkev/rentnerproxy:pr-90-d447c662b978

Docker Compose

In a separate test copy of docker-compose.yml, replace the service image with:

image: ghcr.io/rentnerkev/rentnerproxy:pr-90-d447c662b978

Then use an isolated Compose project:

docker compose --project-name rentnerproxy-pr-90 pull
docker compose --project-name rentnerproxy-pr-90 up -d

The repository Compose file binds ports 80, 81, and 443; change those bindings or stop the production stack before testing.

This preview is intended only for testing this pull request and is not a production release.

@RentnerKev
RentnerKev merged commit c1cfde0 into main Sep 12, 2026
21 checks passed
@RentnerKev
RentnerKev deleted the fix/trusted-tls-termination branch September 12, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docker Docker images, Compose configuration, and deployment. area: runtime Caddy and privileged controller runtime behavior. documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(proxy): handle trusted TLS termination without redirect loops

1 participant