Docker: bad resource urls in main page

Hi, I’m trying to setup the Musicbrainz Server with Docker on a v-server, running behind Nginx which is acting as reverse proxy.

When I navigate to the website the stylesheets and javascript files are not loaded, and having a look at the index page I could find urls like this:

<link href="//localhost:5000/static/build/icons-3a8c753.css" rel="stylesheet" type="text/css"/>

I already found out that I could change the domain name by setting MUSICBRAINZ_WEB_SERVER_HOST to my Domain, which replaced localhost with my Domain just fine, so I have something like:

<link href="//mydomain:5000/static/build/icons-3a8c753.css" rel="stylesheet" type="text/css"/>

Now the problem is, that I also need to get rid of the port part. I found the MUSICBRAINZ_WEB_SERVER_PORT but changing this to 443 doesn’t work. If I do this the Musicbrainz server tries to run on 443, but of course my Nginx is already blocking this.

Can somebody tell me how I get rid of the port in the Website, is there any other property to change this? I’m sorry if this is documented somewhere and I didn’t find it.

Thank you in advance, kind regards


Apparently you can omit MUSICBRAINZ_WEB_SERVER_PORT in your case as port 80 is default for HTTP and 443 is default for HTTPS.

It should work thanks to yvanzo patch, but if it doesn’t, maybe have a look at the build/musicbrainz/ file.

1 Like

The default port is 5000 (@jesus2099 mixed it up) as explained in “Advanced configuration” which you seem to have followed correctly. It might be that the documentation to run on port 443 is outdated. I will look into it again. Running on port 80 should work though.


Thanks for your help! Setting MUSICBRAINZ_WEB_SERVER_PORT to 80 indeed works, if I then change my Nginx HTTP port to something different, e.g. 81, since they run on the same server.

But since the Nginx is the reverse proxy for multiple applications I would prefer that it keeps using 80/443.

Is it somehow possible that the Musicbrainz server is running on port 5000 (or any else except 80/443), but that the Website doesn’t add the port number?

1 Like

If you serve the MB server on a non standard port the port number must be added behind the host name.

But if you have a mind reverse proxy anyway you can configure it to serve your MB installation.

Yes, I’m using Nginx as reverse proxy. I also set MUSICBRAINZ_USE_PROXY=1 in my .env file, but this doesn’t seem to have any effect. When opening the website the Stylesheet and Javascript references still have the port number added.

Indeed the problem is port collision with the reverse proxy, whereas the documentation seems to assume that the reverse proxy would be hosted on a separate machine.

Instead of running on a different port than 80, you can try publishing the port on another network interface than the host loopback, since Docker is usually running its own network interface(s), as follows:

# assuming that both host and port (80) are customized
docker_network_name=$(docker-compose config --format json | jq -r '')
docker_gateway_ip=$(docker network inspect --format json "$docker_network_name" | jq -r '.[].IPAM.Config[].Gateway')
echo "MUSICBRAINZ_DOCKER_HOST_IPADDRCOL=${docker_gateway_ip}:" >> .env
unset docker_network_name docker_gateway_ip
docker-compose up -d musicbrainz

In case your reverse proxy is running on Docker too, and use the same Docker network interface, you would have to add an override to make it use a separate network.

1 Like

Thanks a lot for your help and sorry for the late reply! Unfortunately using your commands resulted in the following error when I tried to start the container:

Error response from daemon: driver failed programming external connectivity on endpoint musicbrainz-docker-musicbrainz-1 (c65568e8e704172cb5f4f14f575416777da9d8da9967af4a657eff2dcd0c41d4): Error starting userland proxy: listen tcp4 bind: cannot assign requested address

I’m not that experienced with docker and don’t fully get what the problem is. It doesn’t sound like the port is already in use, but something else, maybe permissions? (But I tried to use sudo that didn’t have any effect)

I experimented a bit around and thought maybe I could trick the setup a bit. So I tried the following:

Set MUSICBRAINZ_WEB_SERVER_PORT=80 in my .env file so the port number is removed in the stylesheet links, but manually specify port 5000 in the docker-compose.yml:

      - "5000:5000"

That does work, at least I can open the website now under my domain with stylesheets/javascripts. But of course I know that the docker-compose.yml should remain untouched if possible.

Maybe you have another idea, or know why that docker error message was returned?

What confuses me a bit is, why is the domain and port added to the stylesheet links at all per default? At least in my mind the default should be a relative path, so it doesn’t matter if the website is running behind a reverse proxy or not, and that specifying an absolute path with domain and port should be something you explicitely need to do if necessary. But I guess you have reasons to do this, but I find it a bit counterintuitive. (No offense! :slight_smile: )


Good finding. I have no better suggestion.

Unfortunately the repository doesn’t handle some use cases like this one correctly. There are plans to heavily refactor it to make it more flexible and more ready to use.

The default behavior has been set 10 years ago, not sure what was the reason. In production, those files are served from a different domain, so it isn’t using the default value. In mirrors, it has probably never been set. I will investigate whether that can be removed by default or for mirrors at least. Thanks for reporting!


Alright, thanks a lot for your time and help! I’ll stick with the workaround for now since that seems to be working.