Repository navigation
fix(demo): Tier A gets 451 on direct visits too - #31
Merged
Merged
Conversation
nirium.xyz blocks Tier A before it rewrites /avalanche to this demo, but the demo's own domains (avalanche.nirium.xyz and the vercel.app URL) answered anyone. The policy gives Tier A no access to any Nirium service, paid or free. proxy.ts reads Vercel's x-vercel-ip-country and answers 451 to the same nine countries as the site, the node and the markets; unknown passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
M0nsxx
approved these changes
Nov 27, 2026
M0nsxx
left a comment
Member
There was a problem hiding this comment.
AI-assisted review (Claude)
Read the diff: apps/demo/proxy.ts reads Vercel's x-vercel-ip-country and returns 451 with the same JSON as the site, node and markets for the nine Tier A countries in lib/geo.ts, and lets unknown countries through. This closes direct visits to the demo domains, which skipped nirium.xyz's check. Tested locally: IR and KP get 451 on /avalanche, /avalanche/explorer and the icon, and MX, US and no header get 200. tsc and 15/15 tests pass. Approve.
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.
nirium.xyz blocks Tier A before it rewrites
/avalancheto this demo, but the demo's own domains (avalanche.nirium.xyz/avalanche/...and thevercel.appURL) answered anyone. Nirium's Restricted Jurisdictions & Sanctions Policy gives Tier A no access to any Nirium service, paid or free.apps/demo/proxy.ts(Next 16's name for middleware): reads Vercel'sx-vercel-ip-countryand answers 451 with the same JSON as the site, the node and the markets, on every path.apps/demo/lib/geo.ts: the same nine countries (CU, IR, KP, SY, AF, MM, RU, BY, CN). Unknown country passes (policy §7: geolocation is imperfect). Requests rewritten from nirium.xyz were already checked there.lib/geo.test.ts: the list matches the others; only known Tier A countries are blocked.Checked locally with
next build+next start:/avalanche,/avalanche/explorerand/avalanche/icon.svganswer 451 with the header set to IR or KP, and 200 for MX, US and no header. tsc andnpm testpass.🤖 Generated with Claude Code