Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ROOT_URL syntax/possible? #6397

Closed
teotikalki opened this issue Mar 20, 2019 · 5 comments
Closed

Multiple ROOT_URL syntax/possible? #6397

teotikalki opened this issue Mar 20, 2019 · 5 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@teotikalki
Copy link

teotikalki commented Mar 20, 2019

Is it possible to set multiple root urls? My use case involves multiple domains reverse proxied to the same backend vm.

The docs give this:
%(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/

The ()s part of that implies to me that there is a way for mutiple options. I cannot, however, figure out the syntax.
Tried: space separated, comma separated, both of those within round, square and curly brackets

Most attempts get 505 bad gateway.
ROOT_URL = https://(domain1/gitea,domain2/gitea)/
causes both domains to load text only. (Both domains load properly with just one domain in the root url but things like oauth2 logins won't work).

Edit:
ROOT_URL = https://(domain1,domain2)/gitea/
is the best so far, with both domains rendering properly. However, github login doesn't work for either. With ROOT_URL = https://domain1/gitea/ both domains render properly and github login works with domain1.

@teotikalki
Copy link
Author

I think the success of the
ROOT_URL = https://(domain1,domain2)/gitea/
syntax with regards to page rendering proves that multiple ROOT_URLs is possible.

The key question now is whether this will work with the correct syntax or whether the ROOT_URL implementation actually has a bug.

@lunny
Copy link
Member

lunny commented Mar 21, 2019

Multiple ROOT_URL is not supported currently I think.

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Mar 21, 2019
@D-ominik
Copy link

D-ominik commented Oct 5, 2021

I would like to share a use case (which is not so rare for me) to ensure this ticket does not fall into oblivion:

When working for larger clients (means: companies with many employees), the issue section (only this one) should be available for the employees to report problems. So far no problem, you can set the user permissions to limit access to issues.

The clients want the issue tracker to be available under the client's domain (e.g. gitea.company.com), but it actually operates under my own domain (e.g. gitea.mydomain.com). The reasons for this customer request are numerous, but essentially it is about brand identity and avoiding irritation among employees who have followed a link on the intranet and end up on the domain of a company they do not know.

A similar situation: the company hires design agency A, which then hires agency B for the technical development. Agency B should not be mentioned to the client, which is why the issue tracker should be provided under a different domain.

Making Gitea available under multiple domains is possible, at least with regard to the issue tracker, if a few small things are changed:

In the application, some links contain the domain, others (most) do not. In the list of issues, those are linked with domain, which is not necessary in this case and probably easy to change.

The emails sent by Gitea contain links to the web interface and these necessarily include the domain. In this case, it would be good if the URL is based on the domain currently used in the browser (e.g. gitea.company.com instead of gitea.mydomain.com). This is not perfect, because if a developer accesses via the main URL and initiates an action that sends a mail, the customer would receive a mail with the wrong domain. Therefore, it would be even better if the desired domain could be entered in the repository settings and this domain would then always be used for mails.

Another option would be to have a variable with the current domain name and a search-and-replace function available in the templates. Then one could do something like this pseudo code in the mail templates:

{{ if ne .CurrentDomain AppDomain }}
      {{SearchAndReplace .Link AppDomain .CurrentDomain}}
{{ end }}

@wxiaoguang
Copy link
Contributor

Root case is #19345

@besendorf
Copy link

@teotikalki s solution serves the page on both URLs but displays an error message about a wrong ROOT_URL on both domains.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

5 participants