Corey
12/15/2025, 11:03 PMRobert Jaros
12/16/2025, 3:48 AMRobert Jaros
12/16/2025, 3:51 AMrcp_url_prefix global javascript variable, e.g. in the main index.html file, before adding application bundle file:
<script>window["rpc_url_prefix"] = `/something/something';</script>Corey
12/16/2025, 7:59 PMRobert Jaros
12/17/2025, 4:17 AMrpc/*). It should work fine for most simple cases, where the app is deployed on / and when it's deployed using some custom path like /something. But it doesn't always work. One case is when the backend is published separately from the frontend (even on different hosts). The other case is when the application uses history api client routing (nice urls like /some/other/route) - the app will try to call /some/other/rpc/* endpoints and of course it will fail. Such app can also be deployed using a custom /something path, which makes things even harder.Robert Jaros
12/17/2025, 4:25 AMrpc_url_prefix global variable. Its value is read as globalThis.jsGet("rpc_url_prefix"), so it can be set in different ways (externally using window["rpc_url_prefix"] or in Kotlin code using globalThis.jsSet()). The value of the variable (if set) is added to the path called by the RPC client as $urlPrefix/rpc. The value can be both absolute and relative.Robert Jaros
12/17/2025, 4:29 AMwindow["rpc_url_prefix"] = "<http://example.com/backend_path>").Corey
12/17/2025, 4:30 AMrpc_url_prefix was used I thought it still used the relative url + rpc_url_prefix and then /rpc. but using window["rpc_url_prefix"] = "<http://example.com/backend_path>" is exactly what I was afterRobert Jaros
12/17/2025, 4:31 AM/ you can use window["rpc_url_prefix"] = ""; - it will make all RPC calls starting with /.Robert Jaros
12/17/2025, 4:33 AM/something) you need to know (or guess) this path and set window["rpc_url_prefix"] = "/something".Robert Jaros
12/17/2025, 4:36 AM/ or using specific path /something and I'm using such this code in my `index.html`:
var prefix = "";
if (window.location.pathname.startsWith("/something/")) prefix = "/something";
window["rpc_url_prefix"] = prefix;Robert Jaros
12/17/2025, 4:51 AMCorey
12/17/2025, 5:22 AM