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

Submodule Reference - wrong url on subdomain #9756

Closed
5 tasks
Jonas18175 opened this issue Jan 14, 2020 · 7 comments
Closed
5 tasks

Submodule Reference - wrong url on subdomain #9756

Jonas18175 opened this issue Jan 14, 2020 · 7 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@Jonas18175
Copy link

Description

I run the git under subdomain https://git.webserver.xyz
I pushed a repo with a submodule to my git and in the webinterface when i click on the reference link in this repository redirect the webserver.xyz instant of http://git.webserver.xyz. I used https on my server. The link is only http:// - had i missconfigured something or is this a bug?

@bagasme
Copy link
Contributor

bagasme commented Jan 14, 2020

@Jonas18175 What about your app.ini?

@6543
Copy link
Member

6543 commented Jan 14, 2020

@Jonas18175 do you use a reverse ssl proxy?
(we need more information how your gitea inctance is setup)

@Jonas18175
Copy link
Author

Jonas18175 commented Jan 15, 2020

my app.ini:

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
RUN_MODE = prod

[security]
INTERNAL_TOKEN = xxx.xxx.xxx
INSTALL_LOCK   = true
SECRET_KEY     = xxx

[database]
DB_TYPE  = mysql
HOST     = 127.0.0.1:3306
NAME     = gitea
USER     = gitea
PASSWD   = xxx
SSL_MODE = disable
PATH     = data/gitea.db

[repository]
ROOT = /srv/git/gitea-repositories

[server]
SSH_DOMAIN       = xxx.tk
DOMAIN           = git.xxx.tk
HTTP_PORT        = 3030
ROOT_URL         = https://git.xxx.tk
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /var/lib/gitea/data/lfs
LFS_JWT_SECRET   = xxx
OFFLINE_MODE     = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = true
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = true
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.example.org

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = true

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = false

[session]
PROVIDER = file

[log]
MODE      = file
LEVEL     = Info
ROOT_PATH = /var/lib/gitea/log

[oauth2]
JWT_SECRET = xxx

yes i used nginx - but some links in some repos and in others not (submodule):

server {
    root /srv/git;
    server_name www.git.xxx.tk git.xxx.tk; 

    index index.html index.php;

    access_log /var/log/nginx/git.access;
    error_log  /var/log/nginx/git.error error;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/git.xxx.tk/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/git.xxx.tk/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    location / {
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:3030;
        proxy_redirect off;
    }


}

server {
    listen 80;
    server_name www.git.xxx.tk git.xxx.tk;

    if ($host = www.git.xxx.tk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = git.xxx.tk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    return 404; # managed by Certbot
}

@stale
Copy link

stale bot commented Mar 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Mar 15, 2020
@stale
Copy link

stale bot commented Mar 29, 2020

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this as completed Mar 29, 2020
@zeripath zeripath added type/bug issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Mar 29, 2020
@zeripath zeripath reopened this Mar 29, 2020
@stale stale bot removed the issue/stale label Mar 29, 2020
@zeripath
Copy link
Contributor

Sorry I don't think anyone has had any time to look into this - however, I can see how this could happen.

The trouble is in general it's very hard (I think impossible) to definitively convert an arbitrary submodule to a http link however, we can and should be doing it correctly for things that point to the same gitea instance.

A general solution would likely involve the repository having some set-up whereby it has a mapping from submodule to its http address.

@mrsdizzie
Copy link
Member

mrsdizzie commented Mar 29, 2020

This should work, what is in the [submodule] section of the git repo?

mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Sep 6, 2020
Right now we only compare the hostname from a submodule with the prefixURL it is viewed from to check if the submodule is hosted on the same Gitea instance. This adds an additional check to compare it against SSH_DOMAIN as well since the same Gitea instance might have a different hostname for SSH and if the submodule uses that hostname we should also detect that and link to the proper DOMAIN value.

Fixes go-gitea#12747, go-gitea#9756
techknowlogick pushed a commit that referenced this issue Sep 8, 2020
Right now we only compare the hostname from a submodule with the prefixURL it is viewed from to check if the submodule is hosted on the same Gitea instance. This adds an additional check to compare it against SSH_DOMAIN as well since the same Gitea instance might have a different hostname for SSH and if the submodule uses that hostname we should also detect that and link to the proper DOMAIN value.

Fixes #12747, #9756
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

No branches or pull requests

6 participants