0

I want to make a simple reverse proxy:

http://outer-ip/gitlab -> http://192.168.1.10:9000

And that's ok, but when I reach my site, I have got tons of 404 in my Mozilla log. Probably te reason is not adding port to request:

GET /assets/webpack/pages.root.ec399de0.chunk.js HTTP/1.1
Host: 192.168.1.10
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0
Accept: */*
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.10/gitlab/
Connection: keep-alive
Cookie: ...
Cache-Control: max-age=0

my nginx routing configuration:

worker_processes 1;
 
events { worker_connections 1024; }
 
http {
    server {
        listen              80;
        port_in_redirect    off;

        location /gitlab/ {
            proxy_pass         http://192.168.1.10:9980/;
            proxy_set_header   Host 192.168.1.10:9980;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
        }
    }
}
KurdTt-
  • 449
  • 1
  • 5
  • 21
  • 1
    I think the reason is that `/assets/webpack/pages.root.ec399de0.chunk.js` URI missed the `/gitlab` prefix thus not being served by your `location /gitlab/ { ... }` block. You can check [How to handle relative urls correctly with a nginx reverse proxy](https://serverfault.com/questions/932628/how-to-handle-relative-urls-correctly-with-a-nginx-reverse-proxy) ServerFault thread or [this](https://stackoverflow.com/a/62840133/7121513) SO answer. – Ivan Shatsky Oct 20 '21 at 09:18
  • Thank You, I'll try. There's one more option, cause gitlab has his own nginx and I don't know if there's another proxy configuration on this server. Nexus works fine – KurdTt- Oct 20 '21 at 20:42

0 Answers0