Using Apache HTTPD with a sub-path as a reverse proxy

I am trying to establish the following setup.
At home, 1 node hosts both apache httpd and gitea. The home firewall lets through https only.

Home PCs => gitea own serving of http on port 3000.
Outside access => https://PublicName/git

I intend to have apache handle https and convert that to simple http to talk gitea.
Here is the VirtualHost

<VirtualHost _default_:443>
DocumentRoot “/var/www/html”
ServerName PublicName:443
ServerAlias PublicName
AllowEncodedSlashes NoDecode
<Location /git>
Require all granted
ProxyPass http://localhost:3000/ nocanon
ProxyPassReverse http://localhost:3000/
</Location>
</VirtualHost>

When from outside, the user accesses https://PublicName/git, I get a poorly formatted page
Also, when the uses clicks “Sign in”, the URL that link targets is

https://PublicName/user/login?redirect_to=
This is wrong because there should ‘/git’ in it.

What should ROOT_URL be in app.ini?

I think that this configuration is not supported; AFAIK Gitea requires / as the root path. What I’d suggest is to set up a server alias and redirect over there. For example:

server: dev.company.com
intended path: dev.company.com/git
actual path: git.company.com

git.company.com points to the same server as dev.company.com, and uses the same certificate, which contains the git alias. Anyone accessing dev.company.com/git should be permanently redirected over git.company.com.

This of course requires manual administration of the server’s certificate to include the alias, but it’s supported by Let’s Encrypt if that’s what you’re using.

I have setup a dns alias cname to point to dev.company.com.

This of course requires manual administration of the server’s certificate to include the alias, but it’s supported by Let’s Encrypt if that’s what you’re using.

I do use Let’s Encrypt, how do I update the certificate then?

Hello, you can check out our reverse proxy documentation for instructions on using a sub-URL in Apache.

Yes i did, that’s how I configured my apache.
However, I desired to access gitea from outside home, and from inside home with 2 different URLs.
That’s what [guillep2k] explained was not quite possible
and I am trying to pursue his solution

Aha, my fault for not reading thoroughly. :grin:

from the reverse proxy doc, a /git suffix is possible

[server] ROOT_URL = http://git.example.com/git/

I drew the setup here:
gitea
It can help. what’s my next step?