Redirect direct visits to ai-inequality-theta.vercel.app to policyengine.org
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- json, next.js
- Domain
- infrastructure
Research direction
Start by reading vercel.json and the existing deployment configuration, then add the host-conditional redirect rules described in the issue, including the UK route rules before the general rules. Check that the JSON is valid and that the rules preserve policyengine.org proxy requests; after deployment, run the two curl checks in the issue to confirm the direct host redirects and the policyengine.org page still returns 200.
Written by the indexing model from the issue text.
Description
policyengine.org serves this app at https://www.policyengine.org/us/ai-inequality: policyengine-app-v2's website/src/data/appZoneRoutes.ts proxies that path to https://ai-inequality-theta.vercel.app. The host also serves every page itself, outside the site, so links to it keep turning up in posts, emails and READMEs. A visit straight to ai-inequality-theta.vercel.app should land on the same page on policyengine.org.
The change
This app builds as a static export in production (output: "export" in next.config.mjs), and Next documents redirects() as unsupported there. Vercel applies vercel.json redirects to a static export built with its Next.js preset (tested on a Next 16.2 export, 2026-10-29). Add these redirects to vercel.json.
{
"redirects": [
{
"source": "/",
"has": [
{
"type": "header",
"key": "x-forwarded-host",
"value": "ai-inequality-theta\\.vercel\\.app"
}
],
"destination": "https://www.policyengine.org/us/ai-inequality",
"permanent": true
},
{
"source": "/(.*)",
"has": [
{
"type": "header",
"key": "x-forwarded-host",
"value": "ai-inequality-theta\\.vercel\\.app"
}
],
"destination": "https://www.policyengine.org/$1",
"permanent": true
}
]
}
Vercel sets x-forwarded-host to the host the visitor asked for, and overwrites any value the visitor sends. That's ai-inequality-theta.vercel.app on a direct visit and www.policyengine.org on a request policyengine.org proxies. So these rules leave policyengine.org's own requests alone, and preview deployments too, since a preview has a host of its own. The pattern, how it was tested and its pitfalls: policyengine-app-v2 docs, "The direct-host redirect". PolicyEngine/ballot-measures-2026#8 adopts it with tests.
The UK route
policyengine.org also serves this app at /uk/ai-inequality, and proxies it to this host's /us/ai-inequality?country=uk. With only the rules above, a direct link with ?country=uk lands on https://www.policyengine.org/us/ai-inequality?country=uk: the UK view at a US address. To send it to /uk/ai-inequality, put these two rules first, ahead of the two above:
[
{
"source": "/us/ai-inequality",
"has": [
{
"type": "header",
"key": "x-forwarded-host",
"value": "ai-inequality-theta\\.vercel\\.app"
},
{
"type": "query",
"key": "country",
"value": "uk"
}
],
"destination": "https://www.policyengine.org/uk/ai-inequality",
"permanent": true
},
{
"source": "/us/ai-inequality/(.*)",
"has": [
{
"type": "header",
"key": "x-forwarded-host",
"value": "ai-inequality-theta\\.vercel\\.app"
},
{
"type": "query",
"key": "country",
"value": "uk"
}
],
"destination": "https://www.policyengine.org/uk/ai-inequality/$1",
"permanent": true
}
]
The query rides along, so the reader lands on https://www.policyengine.org/uk/ai-inequality?country=uk, which serves the same page.
Canonical link and og:url
Once the host redirects, a page whose <link rel="canonical"> or og:url names ai-inequality-theta.vercel.app names a URL that redirects back to it, and policyengine-app-v2's audit fails a redirecting zone whose page does. This page sets neither today (checked 2026-10-29); if you add them, use its https://policyengine.org URL.
Assets and API calls
These rules also redirect direct requests for the host's own assets and API routes. Pages served through policyengine.org load theirs through policyengine.org, so readers there never meet the redirect. But a browser blocks a cross-origin call whose redirect carries no CORS headers, so check that no code calls this host by absolute URL. A code search of the default branch for ai-inequality-theta.vercel.app found nothing (2026-10-29).
Check it
/us/ai-inequality already serves this app on policyengine.org, so this can ship whenever it suits you. After the production deploy:
curl -sI "https://ai-inequality-theta.vercel.app/us/ai-inequality"
That should answer 308 with location: https://www.policyengine.org/us/ai-inequality, and curl -sI "https://www.policyengine.org/us/ai-inequality" should still answer 200.
Then, in policyengine-app-v2, run node .github/scripts/audit-zone-direct-hosts.mjs, and add "/us/ai-inequality" to DIRECT_HOST_REDIRECTS there so the daily audit keeps the redirect in place.
🤖 Generated with Claude Code
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PolicyEngine/ai-inequality
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
Tighten the chart colour guard and the axis checkPossibly taken @MaxGhenis claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
PolicyEngine/ai-inequality#60 ·
Maintainers usually reply within 1 day
All issues in PolicyEngine/ai-inequality
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
Maintainers usually reply within 1 day