Skip to content

Gitlab frontend try to load css file from bundled nginx server ip, but this bundled nginx proxied by another nginx

Gitlab frontend try to load css file from bundled nginx server ip, but this bundled nginx proxied by another nginx

Summary

I have a server with IP 192.168.0.1, installed omnibus gitlab here. and bundled NGINX port is 8081. And another server with ip 192.168.0.2, installed NGINX port 80, proxy_pass 192.168.0.1:8081. When visiting 192.168.0.2, I notice CSS file requests from both 192.168.0.1:8081 and 192.168.0.2 with the same content.

Steps to reproduce

On server 192.168.0.1, set gitlab.rb config

external_url http://192.168.0.2/gitlab
nginx['listen_port'] = 8081

sudo gitlab-ctl reconfigure

On server 192.168.0.2, set nginx.conf

...
location /gitlab {

    if ($request_uri ~* "/gitlab/(.*)") {
        proxy_pass http://192.168.0.1:8081/gitlab/$1;
    }
    # proxy_redirect off;
    proxy_pass http://192.168.0.1:8081/gitlab;
}

sudo nginx -s reload

Visit 192.168.0.2 and find

<meta charset="utf-8">
<link as="style" href="http://192.168.0.1:8081/gitlab/assets/application-a573aed3df818ca78ab40c01ae3514e16271a18e3c83122deab5d5623b25d4fe.css" rel="preload">
<link as="style" href="http://192.168.0.1:8081/gitlab/assets/highlight/themes/white-cb61ba925fa4bdc9f25cae0b5c45204fc0704487dfa3c7e1750b97cf806ca674.css" rel="preload">

<meta content="IE=edge" http-equiv="X-UA-Compatible">

What is the current bug behavior?

If user cannot get access to 192.168.0.1, so the web pages will hang until meet connection timeout.

What is the expected correct behavior?

Web page should only load from setting external_url or relative url.

Details of package version

gitlab-ce-13.11.3-ce.0.el7.x86_64

Configuration details

external_url 'http://192.168.0.2/gitlab'
nginx['listen_port'] = 8081