Could not visit any files in a repo

Hi, I have gitlab-ce 12.10.6 installed on my Synology nas via docker. When I visit my repo, I could not open any single file in that repo, say the README.md, it would redirect me to my website home page. For example, when I visit http://172.21.125.122/username/reponame/-/blob/master/README.md, it redirects me to http://172.21.125.122:5000/, where 5000 is the default port for synology nas admin webpage.

Here is the log: gitlab.log, unicorn_stdeer.log.

How could I make it work again?

Edit:
My port direct: 40080 <-> 80
So the correct url for my repo is http://172.21.125.122:40080/username/reponame, but when I click a file in the repo, the url is without port, that is why I get the error. I don’t know why.

I try with a newly deploy instance with:

sudo docker run --detach \
  --hostname 192.168.1.11 \
  --env GITLAB_OMNIBUS_CONFIG="external_url 'http://192.168.1.11'; gitlab_rails['lfs_enabled'] = true;" \
  --publish 40443:443 --publish 40080:80 --publish 40022:22 \
  --name gitlab \
  --restart always \
  gitlab/gitlab-ce:latest

And then I visit 192.168.1.11:40080, create my first repo with a README.md. The README.md is http://192.168.1.11/root/helloworld/-/blob/master/README.md, but the correct url should be http://192.168.1.11:40080/root/helloworld/-/blob/master/README.md. Other url not related to files in the repo is correct, say http://192.168.1.11:40080/dashboard/projects. So what is going on?

I carefully read this section, it’s said that:

The port specified in this URL must match the port published to the host by Docker.

Did it mean I have to use --publish 40080:40080 --env GITLAB_OMNIBUS_CONFIG="external_url 'http://192.168.1.11:40080'; not --publish 40080:80 --env GITLAB_OMNIBUS_CONFIG="external_url 'http://192.168.1.11'? I have to use the same port in both container and host for webpage (gitlab rails?), default is 80, but I the 80 port in host is occupied, I have to specify the a new same port in both container and host, say 40080:40080, and add it to external_url?

hi,

The base URL needs to know where it can be reached. external_url + /root/helloworld/-/blob/master/README.md is what you get for the link.

The port mapping is imho fine with

host: 40080
container: 80

From a network perspective, the client opening a website will always come via 192.168.x.x and not use any other local routing.

Cheers,
Michael

1 Like