Replace iframe with Vercel reverse proxy support#107
Merged
PavelMakarchuk merged 1 commit intomainfrom Feb 17, 2026
Merged
Conversation
Replace iframe embedding with Vercel reverse proxy architecture so that policyengine.org/us/state-legislative-tracker/* serves tracker HTML directly from Modal, with proper SEO canonical URLs on policyengine.org. - Rename Vite assetsDir from assets/ to _tracker/ to avoid path collisions - Add BASE_PATH detection for proxied vs standalone routing - Update prerender canonical URLs, sitemap, robots.txt to policyengine.org - Update og:image to policyengine.org domain - Bump APP_VERSION to v22 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Closes #106
Prepare the tracker for a crawler-only reverse proxy on policyengine.org. Search engines and social scrapers will receive the tracker HTML directly (with proper canonical URLs, structured data, and sitemap on policyengine.org). Regular users continue to see the tracker inside the existing iframe with the full policyengine.org nav/footer — no visual change for humans.
This repo (tracker)
assetsDirfromassets/to_tracker/to avoid path collisions with app-v2's/assets/BASE_PATHmodule that detects proxied (/us/state-legislative-tracker) vs standalone routingpushStatecalls in App.jsx and StatePanel.jsx to useBASE_PATHpolicyengine.orgog:imageto policyengine.org domain/assetsto/_trackerAPP_VERSIONto v22Companion changes needed in policyengine-app-v2
vercel.json: Add rewrite rules for/_tracker/:path*→ Modal (assets)app/middleware.ts: For crawler user-agents hitting/us/state-legislative-tracker/*, let the Vercel rewrite serve Modal HTML directly instead of the app shell. Regular users still get the iframe page.Architecture
Backward compatibility
All existing URLs continue working:
modal.run/GA— standalone, unchanged (BASE_PATH='')policyengine.org/.../state-legislative-tracker— iframe for users, proxy for crawlers#GA) — redirect logic preservedDeploy order
Test plan
npm run build→dist/_tracker/has JS/CSS, nodist/assets/index.htmlreferences/_tracker/index-*.js/GA, click bill →/GA/bill-id, back button worksmodal.run/GAstill workscurl -A Googlebot .../state-legislative-tracker/GA→ tracker HTML with canonical policyengine.org URL🤖 Generated with Claude Code