Skip to content

feat: honour HTTPS_PROXY env var for outbound fetches#404

Merged
danielroe merged 3 commits into
mainfrom
fix-proxy-support
May 25, 2026
Merged

feat: honour HTTPS_PROXY env var for outbound fetches#404
danielroe merged 3 commits into
mainfrom
fix-proxy-support

Conversation

@danielroe
Copy link
Copy Markdown
Member

@danielroe danielroe commented May 25, 2026

this adds undici as a dep + honors HTTPS_PROXY/HTTP_PROXY environment variables if set and not otherwise configured.

Summary by CodeRabbit

  • New Features

    • Support for HTTP/HTTPS proxy via environment variables (HTTPS_PROXY, HTTP_PROXY, and lowercase variants), allowing builds to fetch font data behind corporate proxies without extra setup.
  • Documentation

    • README updated to document proxy environment variable support and usage.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@danielroe, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 2 reviews of capacity. Refill in 20 minutes and 15 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c0320a2b-d9ce-48be-ba88-471cf648cde8

📥 Commits

Reviewing files that changed from the base of the PR and between 5c6eb4f and dab5893.

📒 Files selected for processing (1)
  • test/proxy.test.ts
📝 Walkthrough

Walkthrough

This PR adds HTTP/HTTPS proxy support to unifont by installing undici's EnvHttpProxyAgent as the global fetch dispatcher during startup, enabling font fetches to route through corporate proxies via standard HTTPS_PROXY / HTTP_PROXY environment variables.

Changes

Proxy Support Implementation

Layer / File(s) Summary
Proxy dispatcher module and dependency
src/proxy.ts, package.json
New installProxyDispatcher() function conditionally installs undici's EnvHttpProxyAgent as the process-wide global dispatcher when proxy env vars are present, with idempotency checks and error handling. undici (^7.18.0) added to dependencies.
Integration into createUnifont startup
src/unifont.ts
createUnifont imports and awaits installProxyDispatcher() before provider initialization, ensuring proxy configuration is active before font fetches begin.
User-facing documentation
README.md
Documentation notes that unifont honors HTTPS_PROXY/HTTP_PROXY environment variables (case-insensitive) for outbound font requests during build time.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 A proxy path through corporate walls,
Where unifont's requests now safely crawl,
With undici's agent standing guard,
No more blocked fonts—the PR's not hard!
Environment variables save the day,
Fetch flows through now, hip-hip-hooray! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: honour HTTPS_PROXY env var for outbound fetches' accurately describes the main change: adding support for the HTTPS_PROXY environment variable to enable proxy support for outbound font fetches.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-proxy-support

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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.40%. Comparing base (d121188) to head (dab5893).
⚠️ Report is 66 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
+ Coverage   98.32%   98.40%   +0.08%     
==========================================
  Files          12       13       +1     
  Lines         656      690      +34     
  Branches      172      180       +8     
==========================================
+ Hits          645      679      +34     
  Misses         11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/proxy.ts`:
- Around line 17-23: The code sets the module-level flag "installed" before
checking for proxy environment variables, preventing future attempts if env vars
are loaded later; move the assignment of installed = true to after detecting a
non-empty proxyUrl (the const proxyUrl = process.env.HTTPS_PROXY ||
process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy) so
that the function returns early without marking installed when no proxy is
configured, and only mark installed once a proxyUrl is found and proxy setup
proceeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57466034-eacf-4f4d-9eed-da5216e76373

📥 Commits

Reviewing files that changed from the base of the PR and between 91f59d2 and 1e56128.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • README.md
  • package.json
  • src/proxy.ts
  • src/unifont.ts

Comment thread src/proxy.ts
@danielroe danielroe merged commit 7f60096 into main May 25, 2026
10 checks passed
@danielroe danielroe deleted the fix-proxy-support branch May 25, 2026 13:21
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