Proxy /uk/data.json so student-loan-visualisation figures render#1054
Merged
Conversation
The source HTML at student-loan-visualisation.vercel.app does
fetch('./data.json'). Under the multizone rewrite at
/uk/student-loan-visualisation (no trailing slash), the relative URL
resolves to /uk/data.json, which 404s — so the D3 figures and the
decile table never get data. Adding the trailing slash isn't viable
because Next.js's default trailingSlash:false auto-strips it.
This adds an afterFiles rewrite proxying /uk/data.json to the source.
A more durable fix is to give the source repo an absolute path or a
basePath, at which point this hot-patch can be removed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
JSON data proxies (like /uk/data.json → student-loan-visualisation/data.json) have no HTML layout to install gtag into, so the audit's gtag check doesn't apply. Same rationale as the existing .svg/.css/.js skip list. Co-Authored-By: Claude Opus 4.7 (1M context) <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
/uk/student-loan-visualisationrendered with empty figures and an empty decile table. Root cause: the source HTML atstudent-loan-visualisation.vercel.appdoesfetch('./data.json'). Under the multizone rewrite at/uk/student-loan-visualisation(no trailing slash), the relative URL resolves to/uk/data.json→ 404, so the D3 charts and table never get data.A trailing-slash redirect doesn't work — Next.js's default
trailingSlash: falseauto-strips it (verified:GET /uk/student-loan-visualisation/→ 308 → no slash).This adds a one-line
afterFilesrewrite proxying/uk/data.json→student-loan-visualisation.vercel.app/data.json. A more durable fix is to give the source repo an absolute path orbasePath: '/uk/student-loan-visualisation', at which point this hot-patch can be removed.The diff looks larger than the change because Prettier reformatted neighboring rewrites onto multiple lines. The only behavioral change is the new
/uk/data.jsonentry inafterFiles.Test plan
data.jsonrequest returns 200 with the JSON payload🤖 Generated with Claude Code