Commit Graph

7 Commits (e4c034bc5caa6ac3d29e3bf0eca834cd6c50d4ae)

Author SHA1 Message Date
wxiaoguang 3b10fd9b34
Only use Host header from reverse proxy ()
X-Forwarded-Host has many problems: non-standard, not well-defined
(X-Forwarded-Port or not), conflicts with Host header, it already caused
problems like . So do not use X-Forwarded-Host, just use Host
header directly.

Official document also only uses `Host` header and never mentioned
others.
wxiaoguang 84cbb6c4d2
Fix duplicate sub-path for avatars ()
Fix , and add tests

And this PR introduces an undocumented & debug-purpose-only config
option: `USE_SUB_URL_PATH`. It does nothing for end users, it only helps
the development of sub-path related problems.

And also fix 

Co-authored-by: @ExplodingDragon
wxiaoguang 339bc8bc8f
Improve reverse proxy documents and clarify the AppURL guessing behavior ()
Fix 

1. Mention Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea
2. Clarify the basic requirements and move the "general configuration" to the top
3. Add a comment for the "container registry"
4. Use 1.21 behavior if the reverse proxy is not correctly configured

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
wxiaoguang 67c1a07285
Refactor AppURL usage ()
Fix 
Fix 

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
wxiaoguang ca4107dc96
Refactor external URL detection ()
Follow , `IsExternalURL` is not needed anymore. 
Add some tests for `RedirectToCurrentSite`
wxiaoguang 01500957c2
Refactor URL detection ()
"Redirect" functions should only redirect if the target is for current Gitea site.
wxiaoguang b71cb7acdc
Use fetch to send requests to create issues/comments ()
Follow 

Network error won't make content lost. And this is a much better
approach than "loading-button".

The UI is not perfect and there are still some TODOs, they can be done
in following PRs, not a must in this PR's scope.

<details>


![image](https://github.com/go-gitea/gitea/assets/2114189/c94ba958-aa46-4747-8ddf-6584deeed25c)

</details>