Skip to content

Commit e804953

Browse files
committed
PUBLIC_URL_DETECTION
1 parent ed8cedc commit e804953

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ RUN_USER = ; git
7474
;; especially when the Gitea instance needs to be accessed in a container network.
7575
;; * legacy: generate the public URL by "Host" header if "X-Forwarded-Proto" header exists, otherwise use "ROOT_URL".
7676
;; * auto: always use "Host" header, and also use "X-Forwarded-Proto" header if it exists. If no "Host" header, use "ROOT_URL".
77-
;PUBLIC_URL_GENERATION = legacy
77+
;PUBLIC_URL_DETECTION = legacy
7878
;;
7979
;; For development purpose only. It makes Gitea handle sub-path ("/sub-path/owner/repo/...") directly when debugging without a reverse proxy.
8080
;; DO NOT USE IT IN PRODUCTION!!!

modules/httplib/url.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func GuessCurrentHostURL(ctx context.Context) string {
6969
// 3. There is no reverse proxy.
7070
// Without more information, Gitea is impossible to distinguish between case 2 and case 3, then case 2 would result in
7171
// 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.
72+
// So we introduced "PUBLIC_URL_DETECTION" option, to control the guessing behavior to satisfy different use cases.
7373
req, ok := ctx.Value(RequestContextKey).(*http.Request)
7474
if !ok {
7575
return strings.TrimSuffix(setting.AppURL, setting.AppSubURL+"/")

modules/setting/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ func loadServerFrom(rootCfg ConfigProvider) {
289289

290290
defaultAppURL := string(Protocol) + "://" + Domain + ":" + HTTPPort
291291
AppURL = sec.Key("ROOT_URL").MustString(defaultAppURL)
292-
PublicURLGeneration = sec.Key("PUBLIC_URL_GENERATION").MustString(PublicURLLegacy)
292+
PublicURLGeneration = sec.Key("PUBLIC_URL_DETECTION").MustString(PublicURLLegacy)
293293
if PublicURLGeneration != PublicURLAuto && PublicURLGeneration != PublicURLLegacy {
294-
log.Fatal("Invalid PUBLIC_URL_GENERATION value: %s", PublicURLGeneration)
294+
log.Fatal("Invalid PUBLIC_URL_DETECTION value: %s", PublicURLGeneration)
295295
}
296296

297297
// Check validity of AppURL

0 commit comments

Comments
 (0)