How to handle reverse-proxy path prefix in rest server connector of BAP?

What is the preferred way to make the bap client aware of a reverse-proxy path prefix?

For example the bap is reachable under https://example.org/bap-client/index.html. When I configure the rest server connector like this:

import {configure as configurePlatformServerConnectors} from "@com.mgmtp.a12/bap-client/lib/extensions/platform-server-connectors";

// ...

	const platformServerConnectors = configurePlatformServerConnectors({
		serverURL: "/api",
		localeProvider: () => Container.config.get<LocaleProvider>(Container.identifier.LocaleProvider).get(),
		userProvider: () => {
			if (config === undefined) {
				throw new Error("broken setup");
			}
			return AuthenticationSelectors.user()(config.store.getState());
		}
	});

The bap would then contact the rest api via https://example.org/api/melies/SomeModel-overview. This fails because of the missing reverse-proxy path prefix.

The path prefix is only known from deployment on. The bap is deployed as a set of statically hosted files that were build before deployment. I want to support deploying the same artifact to many environments and hence different path prefixes.

So how do I make the rest server connextor aware of the path prefix?

Note that this seems somehow already being done for the sample application, which also uses path prefixes like in <INTERNAL_LINK> How is this done there?

The BAP Client Sample-Application only uses relative URLs to solve this issue.

An alternative is to implement some kind of configuration that is dynamically loaded on the start off the application that contains the correct base URL. This configuration is created during the server deployment.

I only had to change serverURL: "/api", to serverURL: "api", to get it to work.