Unsuccessful openID login because of domain alias name #7324

Closed
opened 2025-11-02 07:22:59 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @stefanak-michal on GitHub (May 11, 2021).

  • Gitea version (or commit ref): 1.14.2
  • Git version: 2.22.0
  • Operating system: CentOS Linux 7
  • Download url from our auto update script: https://dl.gitea.io/gitea/"${LATEST:1}"/gitea-"${LATEST:1}"-linux-amd64
  • Run as: linux service (systemctl) > /usr/local/bin/gitea web -c /etc/gitea/app.ini
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No

Description

Gitea is running on virtual server which has domain name abc-de-git.foo.xy but we have internal network alias for this domain, just git. That means if you want to visit Gitea, you just enter git:3000 into browser. But we want from Gitea to work with full domain name (because of outside access) and in app.ini we have:

DOMAIN           = abc-de-git.foo.xy
HTTP_PORT        = 3000
ROOT_URL         = http://abc-de-git.foo.xy:3000/

After you visit git:3000, you are NOT redirected to full domain name (ROOT_URL). Which means, when you log in with openId button on login screen, it opens up http://git:3000/user/oauth2/authsrv which redirects to auth server correctly with get param redirect_uri%3Dhttp%253A%252F%252Fabc-de-git.foo.xy%253A3000. This is correct, but after you are redirected to this page (back to gitea) from auth server with full domain name, you got 500 error because you are not logged in. I believe the reason is domain mismatch.

I think it can be solved with modification at our dns, which should redirect instead of alias, BUT I believe this should be fixed in Gitea also in login screen where is openID button, target url of this button should have full domain name from ROOT_URL. In this example it will be http://abc-de-git.foo.xy:3000/user/oauth2/authsrv.

Opera Snímka obrazovky_2021-05-11_112300_git

Originally created by @stefanak-michal on GitHub (May 11, 2021). - Gitea version (or commit ref): 1.14.2 - Git version: 2.22.0 - Operating system: CentOS Linux 7 - Download url from our auto update script: https://dl.gitea.io/gitea/"${LATEST:1}"/gitea-"${LATEST:1}"-linux-amd64 - Run as: linux service (systemctl) > /usr/local/bin/gitea web -c /etc/gitea/app.ini - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No ## Description Gitea is running on virtual server which has domain name `abc-de-git.foo.xy` but we have internal network alias for this domain, just `git`. That means if you want to visit Gitea, you just enter `git:3000` into browser. But we want from Gitea to work with full domain name (because of outside access) and in app.ini we have: ``` DOMAIN = abc-de-git.foo.xy HTTP_PORT = 3000 ROOT_URL = http://abc-de-git.foo.xy:3000/ ``` After you visit `git:3000`, you are NOT redirected to full domain name (ROOT_URL). Which means, when you log in with openId button on login screen, it opens up `http://git:3000/user/oauth2/authsrv` which redirects to auth server correctly with get param `redirect_uri%3Dhttp%253A%252F%252Fabc-de-git.foo.xy%253A3000`. This is correct, but after you are redirected to this page (back to gitea) from auth server with full domain name, you got 500 error because you are not logged in. I believe the reason is domain mismatch. I think it can be solved with modification at our dns, which should redirect instead of alias, BUT I believe this should be fixed in Gitea also in login screen where is openID button, target url of this button should have full domain name from ROOT_URL. In this example it will be `http://abc-de-git.foo.xy:3000/user/oauth2/authsrv`. ![Opera Snímka obrazovky_2021-05-11_112300_git](https://user-images.githubusercontent.com/5502917/117792139-4e3f6180-b24b-11eb-81c6-01aff1abb9c8.png)
GiteaMirror added the issue/duplicate label 2025-11-02 07:22:59 -06:00
Author
Owner

@noerw commented on GitHub (May 13, 2021):

Gitea currently does not support access from multiple domains fully.
Closing this as duplicate of #8697

@noerw commented on GitHub (May 13, 2021): Gitea currently does not support access from multiple domains fully. Closing this as duplicate of #8697
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7324