feat(NODE-1967): Add support for custom domain flags & priority, make use of pre-render flag#213
Merged
Merged
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to 030a200. Security Overview
Detected Code Changes
|
There was a problem hiding this comment.
Pull request overview
This PR extends custom domain provider configuration so a provider URL can carry optional domain flags (e.g. prerender) and a provider priority used to break ties when multiple providers return the same domain. It then wires the new prerender flag into routing by propagating resolved flags through request extensions and using them in the prerender middleware decision logic.
Changes:
- Add
CustomDomainHttpProviderparsing (url|flags<priority>) and plumbpriority/flagsinto custom domain provider constructors. - Extend domain deduplication to prefer higher priority (then newer timestamp) and track additional metrics.
- Pass resolved domain flags via
validatemiddleware into request extensions and useFLAG_PRERENDERin prerender decision logic.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/routing/domain.rs |
Adds provider spec parsing, stores priority/flags in lookups, updates deduplication and metrics, and adds tests. |
src/cli.rs |
Switches CLI provider URL lists to CustomDomainHttpProvider so flags/priority can be specified. |
src/core.rs |
Passes provider URL/priority/flags into the custom domain provider constructors; updates local file provider construction. |
src/routing/middleware/validate.rs |
Inserts resolved DomainFlags into request extensions for downstream middleware. |
src/routing/middleware/prerender.rs |
Uses DomainFlags/FLAG_PRERENDER to decide prerender eligibility; updates tests accordingly. |
src/test.rs |
Updates test helper to construct CustomDomain via CustomDomain::new. |
benches/domain_lookup.rs |
Updates benchmark setup to construct CustomDomain via CustomDomain::new. |
Cargo.toml |
Bumps ic-bn-lib, ic-bn-lib-common, and custom domains crate versions to support new functionality. |
Cargo.lock |
Lockfile updates for the dependency bumps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frankdavid
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes custom domain providers accept an URL in form:
It looks a bit crappy but I couldn't come up with anything better w/o overlapping with URL characters 🫤
Where
flag1andflag2are some flags and10is a priority. Both are optional.Currently there's only the
prerenderflag supported that marks the domains obtained from this provider eligible for pre-rendering (given all other conditions are met).The priority is a tie-breaker when two or more providers deliver the same domain -
ic-gatewaywill take the one from the provider with the highest priority. In our case we'll get a certain subset of domains both from our usual custom domains provider & from the Caffeine one too. We need to prefer the Caffeine one to use theprerenderflag from it. Default priority is 0 (can be 0-255).