You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// GuessCurrentAppURL tries to guess the current full app URL (with sub-path) by http headers. It always has a '/' suffix, exactly the same as setting.AppURL
56
+
// GuessCurrentAppURL tries to guess the current full public URL (with sub-path) by http headers. It always has a '/' suffix, exactly the same as setting.AppURL
57
+
// TODO: should rename it to GuessCurrentPublicURL in the future
// If no scheme provided by reverse proxy, then do not guess the AppURL, use the configured one.
64
+
// Try the best guess to get the current host URL (will be used for public URL) by http headers.
68
65
// At the moment, if site admin doesn't configure the proxy headers correctly, then Gitea would guess wrong.
69
66
// There are some cases:
70
67
// 1. The reverse proxy is configured correctly, it passes "X-Forwarded-Proto/Host" headers. Perfect, Gitea can handle it correctly.
71
68
// 2. The reverse proxy is not configured correctly, doesn't pass "X-Forwarded-Proto/Host" headers, eg: only one "proxy_pass http://gitea:3000" in Nginx.
72
69
// 3. There is no reverse proxy.
73
70
// Without more information, Gitea is impossible to distinguish between case 2 and case 3, then case 2 would result in
74
-
// wrong guess like guessed AppURL becomes "http://gitea:3000/" behind a "https" reverse proxy, which is not accessible by end users.
75
-
// So we introduced "UseHostHeader" option, it could be enabled by setting "ROOT_URL" to empty
71
+
// wrong guess like guessed public URL becomes "http://gitea:3000/" behind a "https" reverse proxy, which is not accessible by end users.
72
+
// So we introduced "PUBLIC_URL_GENERATION" option, to control the guessing behavior to satisfy different use cases.
0 commit comments