Fix: Resolve 301 redirects and 404 errors when serving HTML files#50
Open
escudero89 wants to merge 2 commits intoopenai:mainfrom
Open
Fix: Resolve 301 redirects and 404 errors when serving HTML files#50escudero89 wants to merge 2 commits intoopenai:mainfrom
escudero89 wants to merge 2 commits intoopenai:mainfrom
Conversation
Author
|
@yiren-openai @cching-openai please feel free to close it if you think it is not relevant. Thanks for the example :) |
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.
Problem
The
pnpm run servecommand was returning 301 redirects followed by 404 errors when accessing HTML files liketodo-2d2b.html. This happened because theservepackage'scleanUrlsfeature automatically redirectsfilename.htmltofilename(removing the extension), but the actual files have.htmlextensions.Using it in MacOS (15.7.1 (24G231)).
Solution
assets/serve.jsonconfiguration file with{"cleanUrls": false}to disable automatic HTML extension removalpackage.jsonto use the configuration fileChanges
assets/serve.json- disables cleanUrls featurepackage.json- updated serve command to reference the config fileResult
200 OKinstead of301 → 404http://localhost:4444/todo-2d2b.htmlworks correctlyThis fix ensures that the static file server works as expected when serving the built widget assets for the MCP servers.