I have a setup where I have multiple service running with docker compose and one Nginx (nginx:1.19-alpine), which acts as a reverse proxy for all services and serves some static files.
One service is an Influxdb container (influxdb:2.1.0-alpine) which provides a UI for webbrowsers.
I want to reverse proxy to this container, but I get problems with the static files of this container.
This would be my rule so far:
upstream database {
server data-db:8086;
}
server {
listen 80;
location /influx/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://database/;
}
}
I get a white screen, when I browse to http://localhost:8080/influx/ (localhost:8080 is the Nginx)
The console shows me, that the static files cannot be found.
In the image you can see, that the browser tries to find files at / and not /influx/. That's a problem, because I have other things on /
I've seen similar questions, but can't get my setup to run properly.
I guess there is not an real answer to this. I found this two year old Github issue: https://github.com/influxdata/influxdb/issues/15721
It is a known problem, but wasn't fixed as of now.
A workaround could be to use subdomains, so you can serve Influx on a root directory like influx.example.com/ For hosting on localhost one would have to add an entry to the hosts file and add that "domain" to the server directive of nginx.