GitLab Directory Browsing Issue
The problem is from cdn host. I removed it and now it is working.
gitlab_rails["cdn_host"] = "https://git-statics.example.domain"
Problem to Solve
I have set up a self-hosted GitLab instance using Docker with the following architecture:
Components in this architecture:
- Main Postgres server
- VM for object storage (using MinIO)
- Main Redis server
- Dedicated VM for Sidekiq
- Main GitLab instance
- Server for GitLab-Runner
Current Status
Almost all components work correctly:
- Project creation/deletion works
- API functions properly
- Git operations (pull/push) work
- Web IDE shows files and allows modifications
- Commits, tags, and branches display correctly
Issue
The directory browsing functionality does not work as expected - files are not displayed.
Steps to Reproduce
- Checked all backend requests in browser Developer Console
- All requests return 200 status code
- Added intermediate nginx container
- Identified configuration issue with:
external_url = "https://git.example.domain" gitlab_rails["cdn_host"] = "https://git-statics.example.domain" - Observed that:
- Some static files are served from main GitLab server instead of CDN
- Some objects from object storage are also served from main server
Configuration
Main GitLab Server Configuration (gitlab.rb)
gitlab_rails['object_store']['enabled'] = true
gitlab_rails['object_store']['connection'] = {
'provider' => 'AWS',
'region' => 'us-east-1',
'aws_access_key_id' => 'ACCESS_KEY',
'aws_secret_access_key' => 'SECRET_KEY',
'endpoint' => 'https://git-cdn.example.domain',
'path_style' => true
}
gitlab_rails['object_store']['objects']['artifacts']['bucket'] = 'artifacts'
gitlab_rails['object_store']['objects']['external_diffs']['bucket'] = 'external-diffs'
gitlab_rails['object_store']['objects']['lfs']['bucket'] = 'lfs-objects'
gitlab_rails['object_store']['objects']['uploads']['bucket'] = 'uploads'
gitlab_rails['object_store']['objects']['packages']['bucket'] = 'packages'
gitlab_rails['object_store']['objects']['dependency_proxy']['bucket'] = 'dependency-proxy'
gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = 'terraform-state'
gitlab_rails['object_store']['objects']['ci_secure_files']['bucket'] = 'ci-secure-files'
gitlab_rails['gitaly_token'] = 'GITALY_TOKEN'
gitlab_rails['repositories_storages'] = {
'default' => {
'gitaly_address' => 'tcp://127.0.0.1:8075',
'gitaly_token' => 'GITALY_TOKEN'
}
}
gitlab_rails['redis_host'] = 'REDIS_HOST'
gitlab_rails['redis_port'] = 6379
gitlab_rails['redis_password'] = 'REDIS_PASSWORD'
# External PostgreSQL
gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_encoding'] = 'unicode'
gitlab_rails['db_host'] = 'POSTGRES_SERVER'
gitlab_rails['db_port'] = 5432
gitlab_rails['db_username'] = 'gitlab'
gitlab_rails['db_password'] = 'POSTGRES_PASSWORD'
gitlab_rails['db_database'] = 'gitlab'
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "0.0.0.0:8181"
puma['enable'] = true
puma['worker_processes'] = 10
puma['min_threads'] = 4
puma['max_threads'] = 8
postgresql['enable'] = false
redis['enable'] = false
nginx['enable'] = false
gitlab_kas['enable'] = false
gitaly['configuration'] = {
listen_addr: '0.0.0.0:8075',
storage: [
{
name: 'default',
path: '/var/opt/gitlab/git-data/repositories',
},
],
}
Sidekiq Configuration
nginx['enable'] = false
puma['enable'] = false
gitlab_workhorse['enable'] = false
gitaly['enable'] = false
postgresql['enable'] = false
redis['enable'] = false
prometheus['enable'] = false
gitlab_exporter['enable'] = false
gitlab_kas['enable'] = false
sidekiq['enable'] = true
gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_encoding'] = 'unicode'
gitlab_rails['db_host'] = 'POSTGRES_SERVER'
gitlab_rails['db_port'] = 5432
gitlab_rails['db_username'] = 'gitlab'
gitlab_rails['db_password'] = 'POSTGRES_PASSWORD'
gitlab_rails['db_database'] = 'gitlab'
# Main Redis (VM3)
gitlab_rails['redis_host'] = 'REDIS_SERVER'
gitlab_rails['redis_port'] = 6379
gitlab_rails['redis_password'] = 'REDIS_PASSWORD'
# Sidekiq-specific Redis (VM4)
sidekiq['redis_host'] = 'SIDEKIQ_REDIS_SERVER'
sidekiq['redis_port'] = 6379
# Gitaly (VM1)
gitaly['gitlab_secret'] = 'GITALY_TOKEN'
gitlab_shell['secret_token'] = 'GITALY_TOKEN'
gitlab_rails['repositories_storages'] = {
'default' => {
'gitaly_address' => 'tcp://GITALY_HOST:8075',
'gitaly_token' => 'GITALY_TOKEN'
}
}
gitlab_rails['object_store']['enabled'] = true
gitlab_rails['object_store']['connection'] = {
'provider' => 'AWS',
'region' => 'us-east-1',
'aws_access_key_id' => 'ACCESS_KEY',
'aws_secret_access_key' => 'SECRET_KEY',
'endpoint' => '[https://git-cdn.example.domain',
'path_style' => true
}
# gitlab_rails['object_store']['storage_options'] = {}
gitlab_rails['object_store']['proxy_download'] = false
gitlab_rails['object_store']['objects']['artifacts']['bucket'] = 'artifacts'
gitlab_rails['object_store']['objects']['external_diffs']['bucket'] = 'external-diffs'
gitlab_rails['object_store']['objects']['lfs']['bucket'] = 'lfs-objects'
gitlab_rails['object_store']['objects']['uploads']['bucket'] = 'uploads'
gitlab_rails['object_store']['objects']['packages']['bucket'] = 'packages'
gitlab_rails['object_store']['objects']['dependency_proxy']['bucket'] = 'dependency-proxy'
gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = 'terraform-state'
gitlab_rails['object_store']['objects']['ci_secure_files']['bucket'] = 'ci-secure-files'
external_url 'https://git.example.domain'
gitlab_rails['cdn_host'] = 'https://git-statics.example.domain'
Versions
- Self-managed GitLab Enterprise Edition v17.11.1-ee
