Redirect direct visits to coverage-compass-policy-engine.vercel.app to policyengine.org
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- next.js, typescript
Rechercherichtung
Start with frontend/next.config.ts, then inspect frontend/src/app/layout.tsx, frontend/public/sitemap.xml and frontend/public/robots.txt for the current URLs. Check for absolute calls to the Vercel host and follow the linked redirect guidance and tests. Done means direct-host requests redirect to the canonical policyengine.org URLs while proxied requests still work; the issue also calls for a production curl check and an audit update in policyengine-app-v2.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
policyengine.org serves this app at https://www.policyengine.org/us/coverage-compass: policyengine-app-v2's website/src/data/appZoneRoutes.ts proxies that path to https://coverage-compass-policy-engine.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 coverage-compass-policy-engine.vercel.app should land on the same page on policyengine.org.
The change
In frontend/next.config.ts, add three redirects. 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/coverage-compass";
const directVisit = [
{ type: "header" as const, key: "x-forwarded-host", value: "coverage-compass-policy-engine\\.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 coverage-compass-policy-engine.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 coverage-compass-policy-engine.vercel.app names a URL that redirects back to it, and policyengine-app-v2's audit fails a redirecting zone whose page does. Today this page's canonical link and og:url name https://coverage-compass.policyengine.org, a subdomain that no longer resolves (checked 2026-10-29): frontend/src/app/layout.tsx sets it as metadataBase and in the JSON-LD, and frontend/public/sitemap.xml and frontend/public/robots.txt use it too. In the same change, point the canonical link and og:url at https://policyengine.org/us/coverage-compass, and the JSON-LD, sitemap and robots.txt at URLs under it.
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 coverage-compass-policy-engine.vercel.app found nothing (2026-10-29).
Check it
/us/coverage-compass already serves this app on policyengine.org, so this can ship whenever it suits you. After the production deploy:
curl -sI "https://coverage-compass-policy-engine.vercel.app/us/coverage-compass"
That should answer 308 with location: https://www.policyengine.org/us/coverage-compass, and curl -sI "https://www.policyengine.org/us/coverage-compass" should still answer 200.
Then, in policyengine-app-v2, run node .github/scripts/audit-zone-direct-hosts.mjs, and add "/us/coverage-compass" to DIRECT_HOST_REDIRECTS there so the daily audit keeps the redirect in place.
🤖 Generated with Claude Code
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1
- Forks
- 0
- Ø Merge
- 2 Std. 1 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Ähnliche Issues
-
e2e-failure ready-to-code
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
redhat-developer/rhdh-plugin-export-overlays#4733 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
S-Needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 2 Tagen
-
CLI Empathy needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
chromaui/chromatic-cli#1665 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
software-mansion/argent#1854 ·
Maintainer antworten meist innerhalb von 1 Tag
-
FAQ Spacing IssueOffen
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
nilbuild/developer-roadmap#10557 ·
Maintainer antworten meist innerhalb von 1 Tag