Gitea: Add display URL different than the ROOT_URL for the clone url shown on the web interface

Created on 5 Nov 2019  路  6Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.9.5+1-gf10489898
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04
  • Database (use [x]):

    • [x] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [ ] No

    • [x] Not relevant

  • Log gist:

Description

I need a way to display a clone URL in the web interface that is different than the ROOT_URL because I am using nginx as a reverse proxy, and force/redirect users to SSL on port 443, I actually have port 3000 blocked on purpose, more info below.

I have Gitea running as HTTP on port 3000.

I then have nginx setup as a reverse proxy, and this is where I both redirect any calls from HTTP to HTTPS, as well as implement my certs. This is working perfectly. The machine has UFW(firewall) installed, and ports 80/443 exposed. So this keeps users on port 443 like I want them and not port 3000, port 3000 is blocked by both my router firewall as well as UFW which takes care of traffic on my local network that tries to use port 3000.

so in my screenshot below I would actually prefer the clone URL to be

https://git.domain.com/Jake/BuildingEscape.git

instead of

http://git.domain.com:3000/Jake/BuildingEscape.git

Screenshots

image

All 6 comments

ROOT_URL is almost exclusively used for display purposes.
Gitea actually uses the HTTP_PORT and PROTOCOL settings for running, so as long as those are set correctly, ROOT_URL should be configured to whatever users use to get to your instance.

The reverse proxy guide in the docs cover this a little.
The FAQ also has a section for clone URLs.

hmmm if I am understanding you correctly, I can exclude ROOT_URL from my app.ini and the ROOT_URL would instead be configured according to how users access the web interface. I have read over the pages you linked, going to try tinkering a bit and see if I can get this displaying the clone url correctly. THANK YOU!

ROOT_URL is required here. If it is omitted, it will default to %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
It should be configured to match how users access your instance. For example, it should match your reverse proxy section.

OH! so that means if I want to use HTTPS, then I must configure Gitea to use HTTPS as well as CERTS, all so that the displayed clone URL will display correctly. This is unfortunate, I was hoping to leave gitea as HTTP and let Nginx handle the HTTPS side of things, it simplifies permissions issues with the cert files as well.

Thanks to your links though I did see that I can simply use DISABLE_HTTP_GIT to hide the link.

Can you confirm, there is no way to have the clone URL display as HTTPS which is what nginx is using if Gitea is configured to use HTTP?

You can just do this:

ROOT_URL: https://git.domain.com/

ROOT_URL is just "what I want to show people in the clone window" which sounds like exactly the option you want here. Some people might want it to alway match the protocol and domain name gitea is using but you can enter anything

OH WOW! I didnt realize that ROOT_URL was exactly the feature I was requesting. I thought it had importance beyond the displayed clone url that if altered would break the site. Thanks guys, working perfectly now!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

haytona picture haytona  路  3Comments

jorise7 picture jorise7  路  3Comments

adpande picture adpande  路  3Comments

jonasfranz picture jonasfranz  路  3Comments