Redirect direct visits to givecalc.vercel.app to policyengine.org
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- nextjs, typescript
- Área
- frontend, infrastructure
Línea de trabajo
Lee primero frontend/next.config.ts, especialmente la lista de retorno existente de redirects() y la exportación nextConfig. Añade las dos constantes encima de nextConfig, luego agrega las tres reglas de redirección has: directVisit exactamente como se especifica para que las visitas directas a root y /:path* se resuelvan antes de las solicitudes de proxy. Verifica con curl -sI https://givecalc.vercel.app/us/givecalc esperando 308 a la URL de policyengine.org, y confirma que https://www.policyengine.org/us/givecalc sigue devolviendo 200. Por último, añade /us/givecalc a DIRECT_HOST_REDIRECTS en audit-zone-direct-hosts.mjs de policyengine-app-v2.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
policyengine.org serves this app at https://www.policyengine.org/us/givecalc: policyengine-app-v2's website/src/data/appZoneRoutes.ts proxies that path to https://givecalc.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 givecalc.vercel.app should land on the same page on policyengine.org.
The change
In frontend/next.config.ts, add three redirects. Its redirects() already returns a list: add these three to the end of it, so old paths resolve on this host first, and define PUBLIC_URL and directVisit above nextConfig. as const keeps the condition's type the literal "header": without it TypeScript widens it to string, which Next 16's NextConfig type rejects (TS2322, checked on Next 16.2.6).
const PUBLIC_URL = "https://www.policyengine.org/us/givecalc";
const directVisit = [
{ type: "header" as const, key: "x-forwarded-host", value: "givecalc\\.vercel\\.app" },
];
// in nextConfig:
async redirects() {
return [
// The host's root, outside the basePath.
{ source: "/", basePath: false, has: directVisit, destination: PUBLIC_URL, permanent: true },
// The bare basePath. Without this rule Vercel sends it to PUBLIC_URL + "/", a second hop.
{ source: "/", has: directVisit, destination: PUBLIC_URL, permanent: true },
{ source: "/:path*", has: directVisit, destination: `${PUBLIC_URL}/:path*`, permanent: true },
];
},
Vercel sets x-forwarded-host to the host the visitor asked for, and overwrites any value the visitor sends. That's givecalc.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.
Canonical link and og:url
Once the host redirects, a page whose <link rel="canonical"> or og:url names givecalc.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 givecalc.vercel.app found nothing (2026-10-29).
Check it
/us/givecalc already serves this app on policyengine.org, so this can ship whenever it suits you. After the production deploy:
curl -sI "https://givecalc.vercel.app/us/givecalc"
That should answer 308 with location: https://www.policyengine.org/us/givecalc, and curl -sI "https://www.policyengine.org/us/givecalc" should still answer 200.
Then, in policyengine-app-v2, run node .github/scripts/audit-zone-direct-hosts.mjs, and add "/us/givecalc" to DIRECT_HOST_REDIRECTS there so the daily audit keeps the redirect in place.
🤖 Generated with Claude Code
- Lenguaje dominante
- TypeScript
- Estrellas
- 0
- Forks
- 2
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/givecalc
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
PolicyEngine/givecalc#53 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
PolicyEngine/givecalc#47 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
PolicyEngine/givecalc#46 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
PolicyEngine/givecalc#41 · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de PolicyEngine/givecalc
Issues similares
-
guards: accept readonly arrays (and other array-likes) in isEmpty / hasElements / safeLengthAbiertoenhancement tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
danielmiessler/LifeOS#2533 ·
Los mantenedores suelen responder en 9 días
-
auto:producer auto:uiux
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fritzprix/libr-agent#2447 ·
Los mantenedores suelen responder en 1 día
-
bug low priority
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100