-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Multi-domain support, ROOT_URL problem, use relative URLs in templates instead of absolute URLs #19345
Copy link
Copy link
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtopic/uiChange the appearance of the Gitea UIChange the appearance of the Gitea UItype/proposalThe new feature has not been accepted yet but needs to be discussed first.The new feature has not been accepted yet but needs to be discussed first.type/refactoringExisting code has been cleaned up. There should be no new functionality.Existing code has been cleaned up. There should be no new functionality.
Metadata
Metadata
Assignees
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtopic/uiChange the appearance of the Gitea UIChange the appearance of the Gitea UItype/proposalThe new feature has not been accepted yet but needs to be discussed first.The new feature has not been accepted yet but needs to be discussed first.type/refactoringExisting code has been cleaned up. There should be no new functionality.Existing code has been cleaned up. There should be no new functionality.
Type
Fields
Give feedbackNo fields configured for issues without a type.
At the moment, Gitea users must set ROOT_URL correctly in
app.ini, otherwise many URLs on the web UI will be wrong, which makes the web UI doesn't work properly (CSRF tokens and cookies can not work across domains)The ROOT_URL must be set to the full URL which the users visit, with correct scheme(eg:
https://the-gitea-domain/) and correct sub path if it is used (eg:https://the-gitea-domain/my-gitea-path/).New code should always use relative URLs for Web UI.
Many maintainers have answered the issues about incorrect ROOT_URL again and again.
Using
HTMLURL(and other absolute URLs) in templates is the root case that Gitea can only serve web under ROOT_URL.That's why we have to force users to set ROOT_URL correctly.
If all URLs in template can be refactored to use Relative URL correctly, then we do not need to force users set ROOT_URL correctly again and again.
The ROOT_URL is still needed because for example, some webhooks need the absolute URL for external systems, and Gitea should show absolute URL on the UI for clone link, etc.
Related:
Some more related:
window.location.origin#20089 , it may resolve the incorrect redirection problem during installation.The PR to detect the problem: