Fix management panel responses to include Content-Length - #292
Merged
Merged
Conversation
Contributor
Author
|
自家部署的时候发现前端 让 Codex 查了查,是 io.Copy 直出,到了 nginx 变成了 Transfer-Encoding: chunked 缓存出问题了。 nginx + docker 方案 |
Owner
|
感谢 PR,看过这次改动了,方向是合理的。 新实现用 性能上只是在 CI 已通过,改动范围也比较小。我这边没有看到阻塞合并的问题。后续可以考虑补充 HEAD / Range / If-Modified-Since 的测试,但不作为当前合并阻断。 |
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
This PR changes the manager panel HTML response to use static-file style response semantics instead of streaming the file with a bare
io.Copy.For
PANEL_PATH-backed panels, the server now useshttp.ServeContent, which providesContent-Length,Accept-Ranges,Last-Modified, and proper handling forHEAD/ range / conditional requests.For the embedded panel fallback, the server now sets
Content-Lengthexplicitly before writing the embedded HTML bytes.Scope
Changes
PANEL_PATHmanagement panel HTML withhttp.ServeContentinstead of manual streaming.Content-Lengthfor embedded management panel responses.Content-Lengthfor both embedded andPANEL_PATHpanel responses.User Impact
Users loading
/management.htmlthrough nginx/reverse proxies should get a more stable panel download, especially for large single-file panel builds.This does not change the panel UI or management API behavior.
Compatibility / Runtime Notes
PANEL_PATH-backed/management.htmlserving by making it behave like a normal static file response.Content-Length.Data / Security Notes
N/A. This PR only changes HTTP response semantics for the management panel HTML.
Risk / Rollback
Risk level: Low
Rollback notes:
io.Copyresponse behavior.Verification
Commands / evidence:
Build output confirms the panel is a large single-file HTML asset:
Production evidence before the fix showed the upstream app serving
/management.htmlas a chunked response:Nginx access logs showed multiple partial-size
200responses while proxying the old chunked route:Nginx also repeatedly buffered the old upstream response to temporary files:
Local verification after the fix returned stable static-file style headers:
Repeated local downloads returned the full expected size.
Screenshots / Recordings
N/A. Backend response behavior change only; no visible UI changes.
Docs
Related
N/A