Dash JS files downloading to wrong place

I’m trying to deploy a Dash app using Google Cloud Run, with constraints on who can view it. The plan is to have an overall domain, with a number of apps/services within it; e.g. https://our.analytics.apps/app1, https://our.analytics.apps/app2 etc.

The Cloud Run approach to this is to set up a load balancer with a URL mask (and some other stuff) for the domain, IAM for controlling who can view, etc (which we’ve done). But we’re experiencing an odd issue where when a user browses to https://our.analytics.apps/app1, Dash tries to download its .js files (like bundle.v5_2_4m1686309912.js etc.) to the domain (e.g. https://our.analytics.apps/_dash-component-suites/dash/dash_table/bundle.v5_2_4m1686309912.js) instead of the app (e.g. https://our.analytics.apps/app1/_dash-component-suites/dash/dash_table/bundle.v5_2_4m1686309912.js). This causes an internal error, and the app hangs indefinitely.

To confuse things further; if we deploy the app without the URL mask, e.g. to https://our.analytics.apps, it works absolutely fine.

Has anyone encountered anything like this before?

In case anyone else experiences this issue - the fix was pretty simple, just needed to:

  • add url_base_pathme=app1 to Dash();
  • set the relative_path parameter using get_relative_path() in other pages (as it’s a multi-page app)

After that, everything worked fine.