fix(deploy): support reverse proxy subpaths#1576
Open
langcaiye wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
补充说明一下这个 PR 的设计背景: 这个改动是为了解决 WeKnora 挂在反向代理子路径下的部署场景,例如: https://example.com/weknora/ 这里分成两个配置:
这里没有把剥前缀逻辑放在 Gin middleware 里,而是放在 http.Server.Handler 外层。原因是 Gin middleware 里如果依赖 HandleContext 二次路由,某些 no-route 场景可能先写入 404 状态,再命中真实 handler,导致响应 header 是 404 但 body 是正常内容。放 如果反向代理已经剥掉了路径前缀再转发给后端,则不需要设置 SUBPATH_PREFIX,只设置前端 BASE_URL 即可。 |
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
Tests
Notes