Search code examples
gogs

What is the Gogs ROOT_URL Configuration parameter for?


Gogs has the following server configuration parameters:

[server]
DOMAIN       = 172.17.0.2
HTTP_PORT    = 3000
ROOT_URL     = http://172.17.0.2:3000/

So the ROOT_URL parameter could be constructed from the DOMAIN and the HTTP_PORT the way it is shown above. Is it used in scenarios where Gogs cannot derive it?

TIA, Ole


Solution

  • So the ROOT_URL parameter could be constructed from the DOMAIN and the HTTP_PORT

    That is not always true. The HTTP_PORT is the port gogs listens for incoming traffic, but this does not necessarily mean that you can reach gogs under that port.

    For example, I let gogs listen on port 3000 on localhost, however gogs is available under git.example.com because my apache server, listening on port 80, acts as a proxy and redirects traffic for this subdomain to gogs. If you couldn't configure the ROOT_URL yourself and gogs would just take the DOMAIN and PORT to create the full URL, this wouldn't be possible because gogs would gegerate wrong links and wrong clone-urls.