Skip to content

[Fix] Use elevated ports for tunnel origin - #229

Open
Thiritin wants to merge 1 commit into
forjedio:mainfrom
Thiritin:fix/tunnel-origin-port
Open

[Fix] Use elevated ports for tunnel origin#229
Thiritin wants to merge 1 commit into
forjedio:mainfrom
Thiritin:fix/tunnel-origin-port

Conversation

@Thiritin

@Thiritin Thiritin commented Sep 1, 2026

Copy link
Copy Markdown

I noticed my cloudflared tunnel stopped working (502 on the public hostname). The generated config pointed cloudflared at 127.0.0.1:8443, but since I ran yerd elevate ports the pf redirect makes direct connections to 8443 hang, so cloudflared could never reach the origin. Pointing it at 443 by hand fixed it.

This makes the tunnel check whether the port redirect is active when it starts and use 80/443 in that case, otherwise it keeps using the fallback ports like before. Applies to quick and named tunnels. Might be the cause of #225 as well.

Tested on macOS, cargo fmt, clippy and cargo test -p yerdd pass.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 587246f4-40c3-4acc-9a1b-4685cefa0ee9

📥 Commits

Reviewing files that changed from the base of the PR and between b7e7c1c and 665db72.

📒 Files selected for processing (3)
  • bin/yerdd/src/lib.rs
  • bin/yerdd/src/tunnel/mod.rs
  • bin/yerdd/src/tunnel/named.rs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Changes

Tunnel origin port resolution

Layer / File(s) Summary
Origin port selection and validation
bin/yerdd/src/lib.rs, bin/yerdd/src/tunnel/mod.rs
The crate exposes redirect-port calculation. Tunnel startup probes active redirects when listeners use fallback ports and selects well-known or fallback ports. Unit tests cover these cases.
Tunnel target wiring
bin/yerdd/src/tunnel/mod.rs, bin/yerdd/src/tunnel/named.rs
Quick and named tunnel startup pass resolved plain and TLS ports to tunnel target construction.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 665db

This localized fix changes tunnel origin port selection for active redirects, with normal checks reported as passing; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant TunnelStartup
  participant origin_ports
  participant ActivePortRedirector
  participant OriginTarget

  TunnelStartup->>origin_ports: Resolve listener origin ports
  origin_ports->>ActivePortRedirector: Check active privileged-port redirect
  ActivePortRedirector-->>origin_ports: Return redirect status
  origin_ports-->>TunnelStartup: Return plain and TLS ports
  TunnelStartup->>OriginTarget: Build target with resolved ports
Loading

Suggested reviewers: richardanderson

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: using elevated ports for tunnel origins when a privileged-port redirect is active.
Description check ✅ Passed The description clearly explains the failure, the fix, affected tunnel types, motivation, and macOS validation. It does not use all template headings or checklist boxes, but the required change inform…
Full details: Description check

Explanation

The description clearly explains the failure, the fix, affected tunnel types, motivation, and macOS validation. It does not use all template headings or checklist boxes, but the required change information is mostly present.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@Thiritin Thiritin changed the title [Fix] Dial well-known ports for tunnel origins under an active port redirect [Fix] Use elevated ports for tunnel origin Sep 1, 2026
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.

1 participant