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
// 1. The reverse proxy is configured correctly, it passes "X-Forwarded-Proto/Host" headers. Perfect, Gitea can handle it correctly.
70
70
// 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.
71
71
// 3. There is no reverse proxy.
72
-
// Without an extra config option, Gitea is impossible to distinguish between case 2 and case 3,
73
-
// then case 2 would result in wrong guess like guessed AppURL becomes "http://gitea:3000/", which is not accessible by end users.
74
-
// So in the future maybe it should introduce a new config option, to let site admin decide how to guess the AppURL.
72
+
// With the "USE_HOST_HEADER" config option disabled (default), Gitea is impossible to distinguish between case 2 and case 3,
73
+
// When using "USE_HOST_HEADER", any reverse proxies must be configured to properly pass "X-Forwarded-Proto/Host" headers,
74
+
// otherwise this would result in wrong guess like guessed AppURL becomes "http://gitea:3000/", which is not accessible by end users.
Copy file name to clipboardexpand all lines: modules/setting/server.go
+5
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,10 @@ var (
50
50
AppSubURLstring
51
51
// UseSubURLPath makes Gitea handle requests with sub-path like "/sub-path/owner/repo/...", to make it easier to debug sub-path related problems without a reverse proxy.
52
52
UseSubURLPathbool
53
+
// UseHostHeader makes Gitea always use the "Host" request header for construction of absolute URLs.
54
+
// This requires any reverse proxy to properly pass headers like "X-Forwarded-Proto" and "Host".
55
+
// It maps to ini:"USE_HOST_HEADER" in [server] and defaults to false
56
+
UseHostHeaderbool
53
57
// AppDataPath is the default path for storing data.
54
58
// It maps to ini:"APP_DATA_PATH" in [server] and defaults to AppWorkPath + "/data"
0 commit comments