I'm trying to run check_mk in docker behind a proxy, but I'm having problems with not being able to set the check_mk base_url.
So check_mk is running on http://somehost:6000/sitename/check_mk/ and I need to access it from https://example.com/prefix/check_mk/
I have the following nginx setup:
location /prefix/check_mk/ {
proxy_pass http://somehost:6000;
rewrite ^/prefix/check_mk/(.*) /sitename/check_mk/$1 break;
}
I also have the following proxy config
proxy_http_version 1.1;
# add server_port if we are not running on a standard port or a iptables nat to a standard port
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 86400s;
I can access check_mk for the first time at https://example.com/prefix/check_mk/index.py
However, all links in the returned page are invalid because they're not aware of the proxy. So they're things like https://example.com/checkmksitename/check_mk/dashboard.py instead of https://example.com/prefix/dashboard.py
How do I get something like this working behind a proxy when it doesn't support a base URL to build its links off ?
This is like WAY too late, but I stumbled upon this and ended up figuring it out. This has to be in your location block:
It may be a little more than needed, but it's what worked for me. Best of luck!