[PR #6803] [proxy] Route public TLS port through main listener #27123

Open
opened 2026-08-05 07:08:14 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6803
Author: @CoderSufiyan
Created: 7/16/2026
Status: 🔄 Open

Base: mainHead: fix/issue-6068-tls-passthrough


📝 Commits (4)

  • 3242c3f [proxy] Route public TLS port through main listener
  • 92c8c4f [proxy] Limit server formatting changes
  • a24bae5 [proxy] Keep server startup concise
  • e88b56e Merge remote-tracking branch 'origin/main' into fix/issue-6068-tls-passthrough

📊 Changes

5 files changed (+40 additions, -6 deletions)

View changed files

📝 infrastructure_files/getting-started.sh (+1 -0)
📝 proxy/cmd/proxy/cmd/root.go (+5 -4)
📝 proxy/lifecycle.go (+5 -0)
📝 proxy/server.go (+13 -2)
📝 proxy/server_test.go (+16 -0)

📄 Description

Describe your changes

Add an explicit public port for the proxy main listener and route TLS passthrough mappings on that external port through the existing main SNI router. This handles ingress port translation such as public 443 to internal 8443 without breaking HTTP services sharing the listener.

Custom TLS ports continue to create dedicated listeners. The generated self-hosted configuration now declares the public port explicitly.

Fixes #6068

Stack

  • This PR is independent

Checklist

  • I have performed a self-review of my own code
  • I have tested the changes locally
  • I have added or updated tests where applicable
  • I have checked for breaking changes

Documentation

  • Documentation is not needed

Validation

  • go test ./proxy/... -count=1
  • bash -n infrastructure_files/getting-started.sh
  • git diff --check

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added support for configuring the proxy’s externally visible HTTPS port.
    • Introduced a --public-port CLI option and NB_PROXY_PUBLIC_PORT environment variable (default: 443).
    • Updated the reverse proxy to route traffic arriving on the configured public port using the primary routing path for consistent SNI-based behavior.
  • Bug Fixes
    • Fixed handling where the public HTTPS port could be treated like a separate custom port, avoiding incorrect per-port router behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6803 **Author:** [@CoderSufiyan](https://github.com/CoderSufiyan) **Created:** 7/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/issue-6068-tls-passthrough` --- ### 📝 Commits (4) - [`3242c3f`](https://github.com/netbirdio/netbird/commit/3242c3f49d80031bdde98087024907d832da92e9) [proxy] Route public TLS port through main listener - [`92c8c4f`](https://github.com/netbirdio/netbird/commit/92c8c4f2dcb2a7d7828226159513cb42c7a76d19) [proxy] Limit server formatting changes - [`a24bae5`](https://github.com/netbirdio/netbird/commit/a24bae57d81d3b7d72965e2867a80fd8e2bf2e50) [proxy] Keep server startup concise - [`e88b56e`](https://github.com/netbirdio/netbird/commit/e88b56ee5215b07598000eb4c5743c28f4d20203) Merge remote-tracking branch 'origin/main' into fix/issue-6068-tls-passthrough ### 📊 Changes **5 files changed** (+40 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `infrastructure_files/getting-started.sh` (+1 -0) 📝 `proxy/cmd/proxy/cmd/root.go` (+5 -4) 📝 `proxy/lifecycle.go` (+5 -0) 📝 `proxy/server.go` (+13 -2) 📝 `proxy/server_test.go` (+16 -0) </details> ### 📄 Description ## Describe your changes Add an explicit public port for the proxy main listener and route TLS passthrough mappings on that external port through the existing main SNI router. This handles ingress port translation such as public `443` to internal `8443` without breaking HTTP services sharing the listener. Custom TLS ports continue to create dedicated listeners. The generated self-hosted configuration now declares the public port explicitly. ## Issue ticket number and link Fixes #6068 ## Stack - [x] This PR is independent ## Checklist - [x] I have performed a self-review of my own code - [x] I have tested the changes locally - [x] I have added or updated tests where applicable - [x] I have checked for breaking changes ## Documentation - [x] Documentation is **not needed** ## Validation - `go test ./proxy/... -count=1` - `bash -n infrastructure_files/getting-started.sh` - `git diff --check` <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/netbirdio/codesmith/netbird/pr/6803"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v2.svg"><img alt="View with Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1786808838&installation_id=146802194&pr_number=6803&repository=netbirdio%2Fnetbird&return_to=https%3A%2F%2Fgithub.com%2Fnetbirdio%2Fnetbird%2Fpull%2F6803&signature=6cef715e4fdb5903032319433ddbbc31a88fd6c752756cb5007d4bc69feec793"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a> <sup>Need help on this PR? Tag <code>/codesmith</code> with what you need. Autofix is disabled.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for configuring the proxy’s externally visible HTTPS port. * Introduced a `--public-port` CLI option and `NB_PROXY_PUBLIC_PORT` environment variable (default: 443). * Updated the reverse proxy to route traffic arriving on the configured public port using the primary routing path for consistent SNI-based behavior. * **Bug Fixes** * Fixed handling where the public HTTPS port could be treated like a separate custom port, avoiding incorrect per-port router behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 07:08:14 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#27123