APP_LOCAL_URL default incorrect in docs #10540

Closed
opened 2025-11-02 09:10:45 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @jrjake on GitHub (Mar 28, 2023).

Description

On the Config Cheat Sheet, the default listed for [server] LOCAL_ROOT_URL is only correct when protocol is not fcgi/fcgi+unix/http+unix:

LOCAL_ROOT_URL: %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/: Local (DMZ) URL for Gitea workers (such as SSH update) accessing web service. In most cases you do not need to change the default value. Alter it only if your SSH server node is not the same as HTTP node. Do not set this variable if PROTOCOL is set to http+unix.

See the code here:

	var defaultLocalURL string
	switch Protocol {
	case HTTPUnix:
		defaultLocalURL = "http://unix/"
	case FCGI:
		defaultLocalURL = AppURL
	case FCGIUnix:
		defaultLocalURL = AppURL
	default:
		defaultLocalURL = string(Protocol) + "://"
		if HTTPAddr == "0.0.0.0" {
			defaultLocalURL += net.JoinHostPort("localhost", HTTPPort) + "/"
		} else {
			defaultLocalURL += net.JoinHostPort(HTTPAddr, HTTPPort) + "/"
		}
	}
	LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL)

Gitea Version

6a0ef71984

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

N/A

Database

None

Originally created by @jrjake on GitHub (Mar 28, 2023). ### Description On the [Config Cheat Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#server-server), the default listed for `[server] LOCAL_ROOT_URL` is only correct when protocol is not fcgi/fcgi+unix/http+unix: > LOCAL_ROOT_URL: %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/: Local (DMZ) URL for Gitea workers (such as SSH update) accessing web service. In most cases you do not need to change the default value. Alter it only if your SSH server node is not the same as HTTP node. Do not set this variable if PROTOCOL is set to http+unix. See the code [here](https://github.com/go-gitea/gitea/blob/main/modules/setting/server.go#L297): ``` var defaultLocalURL string switch Protocol { case HTTPUnix: defaultLocalURL = "http://unix/" case FCGI: defaultLocalURL = AppURL case FCGIUnix: defaultLocalURL = AppURL default: defaultLocalURL = string(Protocol) + "://" if HTTPAddr == "0.0.0.0" { defaultLocalURL += net.JoinHostPort("localhost", HTTPPort) + "/" } else { defaultLocalURL += net.JoinHostPort(HTTPAddr, HTTPPort) + "/" } } LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL) ``` ### Gitea Version 6a0ef71984b9246fc1bb378caaa614f3dedaa9e9 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? N/A ### Database None
GiteaMirror added the type/docstype/bug labels 2025-11-02 09:10:45 -06:00
Author
Owner

@lunny commented on GitHub (Mar 28, 2023):

Looks like the logic is too complicated to change the documentation.

@lunny commented on GitHub (Mar 28, 2023): Looks like the logic is too complicated to change the documentation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10540