[SOLVED] HTTPS through proxy: force gitea to present https link

I solved the issue, see below

Greetings, I have been searching, but can’t seem to find the solution to my issue.

I have a certificate issued by my organization for my particular machine. I have set up apache to only work via https, and it serves gitea via proxy. The apache config is:

AllowEncodedSlashes NoDecode
ProxyPass /git http://localhost:3000 nocanon
ProxyPassReverse /git http://localhost:3000

This all works perfectly.

However, gitea believes it is running as http (which it is, behind the proxy), so each repository URL is listed as http://mymachine/git/

Of course, this does not work to clone from a separate machine. It DOES work if the user clones it as https://mymachine/git/… This is because the URL is routed through apache. Furthermore, the organizational firewall won’t allow me to use non-standard ports, so I have to go through 443 (thus preventing me from running gitea as HTTPS and routed through a different port).

So, my question is: how do I tell gitea to present https URLs even though it is running itself as http behind a proxy?


In the app.ini, I had:

ROOT_URL = http://machinename/git

I just needed to change it to:

ROOT_URL = https://machinename/git