Specifying gitea server Gitea Base URL when it is normally accessed via SSH Local Port Forwarding?

Viewed 3181

On my gitea server, I normally access it via ssh Local Port Forwarding; and it isn't accessible from the outside because I bind it to the localhost address.

I'm accessing it from http://127.0.0.1:8080 via "Local Port Forwarding", and it thinks that it's being accessed from http://127.0.0.1:3000; so certain features (the preview in the wiki and the issues for instance do not work (you can however save them, just not preview them); anyway it's mis-configured, see below, I'd like to change the Gitea Base URL so that anytime the server currently writes http://127.0.0.1:3000 it will write http://127.0.0.1:8080 instead (but that said, it would be good if it still operated off of port 3000):

gitea configuration

What line in gitea.ini changes this functionality? or is it more like a situation where I need to throw a reverse proxy in front of it that rewrites the URLs for me?

1 Answers

I did not struggle with port numbers but meant to change the domain (localhost to foo) and found ROOT_URL mentioned in the config cheat sheet:

ROOT_URL: %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/: Overwrite the automatically generated public URL. This is useful if the internal and the external URL don’t match (e.g. in Docker).

There is also a HTTP_PORT option which could apply to you as well.

See your /path/to/gitea/conf/app.ini -> [server] section and change accordingly

[server]
  APP_DATA_PATH    = /path/to/gitea
  DOMAIN           = localhost
  SSH_DOMAIN       = localhost
  HTTP_PORT        = 3000
  ROOT_URL         = http://localhost:3000/

I'd like to change the Gitea Base URL so that anytime the server currently writes http://127.0.0.1:3000 it will write http://127.0.0.1:8080 instead (but that said, it would be good if it still operated off of port 3000):

I assume setting ROOT_URL to http://127.0.0.1:8080 but leaving HTTP_PORT to default 3000 should do that.

Related