NGINX
In your nginx configuration add proxy_set_header option and change proxy_pass like following:
location /gitlab/ {
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3000/gitlab/;
}
GITLAB
What you are looking for is relative URL configuration in GitLab.
If you have GitLab in version 8.5 or above do one of following depending on your GitLab deployment type:
DOCKER-COMPOSE deployment
Add environment variable external_url to your docker-compose.yml file, sample file:
gitlab:
image: 'gitlab/gitlab-ce:11.5.2-ce.0'
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://apps.mycompany.com/gitlab/'
ports:
- '3000:80'
Then restart GitLab docker:
docker-compose up -d
DOCKER deployment
If you are not using docker-compose (which I strongly recommend) then you can add external_url option to you docker run command, sample execution:
docker run --detach --publish 3000:80 --restart always --env GITLAB_OMNIBUS_CONFIG="external_url 'http://apps.mycompany.com/gitlab/'" gitlab/gitlab-ce:11.5.2-ce.0
GitLab configuration files update - can be used in all kinds of deployments
Another approach is to directly modify the GitLab configuration file but I would recommend that for standalone GitLab installations not for docker deployments.
Modify GitLab configuration in /etc/gitlab/gitlab.rb change the external_url value to following:
external_url "http://apps.mycompany.com/gitlab"
Afther this change you have to reconfigure GitLab:
sudo gitlab-ctl reconfigure
Then restart service:
sudo gitlab-ctl restart
You can find more details about GitLab configuration in official documentation.
I recommend that you also check GitLab in docker deployment official documentation.
Please note that relative URL support in Omnibus GitLab is experimental and was introduced in version 8.5 (for earlier version you need to compile it from source - doc).
redirectresponse? Did you check here