Skip to content

feat(NODE-1967): Add support for custom domain flags & priority, make use of pre-render flag#213

Merged
blind-oracle merged 5 commits into
mainfrom
igor/custom-domain-flags
Jul 3, 2026
Merged

feat(NODE-1967): Add support for custom domain flags & priority, make use of pre-render flag#213
blind-oracle merged 5 commits into
mainfrom
igor/custom-domain-flags

Conversation

@blind-oracle

@blind-oracle blind-oracle commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

This makes custom domain providers accept an URL in form:

https://foo.bar/path/to?foo=a|flag1|flag2<10>

It looks a bit crappy but I couldn't come up with anything better w/o overlapping with URL characters 🫤

Where flag1 and flag2 are some flags and 10 is a priority. Both are optional.

  • Currently there's only the prerender flag 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-gateway will 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 the prerender flag from it. Default priority is 0 (can be 0-255).

@blind-oracle blind-oracle requested a review from a team as a code owner July 2, 2026 17:21
@zeropath-ai

zeropath-ai Bot commented Jul 2, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 030a200.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► src/routing/domain.rs
    Add CustomDomainHttpProvider with parsing from string including URL, priority, and optional flags; extend DomainLookup with priority/flags; enhance dedup logic and metrics; update storage to track duplicates overridden
Enhancement ► src/core.rs
    Use CustomDomainHttpProvider.url and propagate priority/flags into provider creation for GenericProvider, Timestamped, and Diff providers; include priority/flags in provider initialization
Enhancement ► src/cli.rs
    Update domain_custom_provider types to CustomDomainHttpProvider; adjust related argument types
Enhancement ► src/routing/middleware/prerender.rs
    Integrate DomainFlags and PRE-RENDER handling into prerender decision flow; adjust header insertion to use DomainFlags-based prerender indicator
Enhancement ► src/routing/middleware/validate.rs
    Attach resolved provider flags to request extensions for downstream use
Enhancement ► benches/domain_lookup.rs
    Update custom domain initialization to use CustomDomain::new with priority via CustomDomainHttpProvider
Enhancement ► src/test.rs
    Update test setup to construct CustomDomain via CustomDomain::new and align with new provider type
Enhancement ► src/routing/domain.rs (additional)     Introduce parsing tests for CustomDomainHttpProvider and verify various input formats (with/without priority and flags)
Enhancement ► src/routing/domain.rs (additional)     Extend tests to cover domain resolution priority and timestamp override behavior with new fields
Enhancement ► src/routing/middleware/prerender.rs     Add new constants and imports for DomainFlags and FLAG_PRERENDER; adjust prerender decision to respect new flags

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 CustomDomainHttpProvider parsing (url|flags<priority>) and plumb priority/flags into custom domain provider constructors.
  • Extend domain deduplication to prefer higher priority (then newer timestamp) and track additional metrics.
  • Pass resolved domain flags via validate middleware into request extensions and use FLAG_PRERENDER in 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.

Comment thread src/routing/domain.rs Outdated
Comment thread src/routing/domain.rs
Comment thread src/routing/middleware/prerender.rs Outdated
Comment thread src/routing/domain.rs Outdated
@blind-oracle blind-oracle merged commit 7e81932 into main Jul 3, 2026
6 checks passed
@blind-oracle blind-oracle deleted the igor/custom-domain-flags branch July 3, 2026 15:47
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.

3 participants