404 from nginx for subpages when deployed on DAML Hub

Hi all,

Am trying to deploy a new typescript ui to DAML Hub. We seem to be having issues with the routing of our subpages and getting 404 errors from nginx.

The ui runs fine with combination of sandbox and npm start but once deployed to daml hub we get 404s. Most suggestions on google are to tweak the nginx.conf which I don’t believe we can easily do given the hosted architecture.

We tried removing the ‘exact’ keyword from our ‘Routes’ in our typescript and downgrading versions of react-router-dom from 6.0.1 to 5.0.1 with no beneficial effect.

Any additional suggestions would be appreciated. Many thanks!

Hi @Andrew_Fielder ,

You are correct that this stems from the nginx congfiguration.

However, on Daml Hub, the nginx server that hosts user websites is not configurable. When deploying an application UI that relies on client-side routing, we therefore recommend using hash-based routing.

With react-router (version 5), this is as simple as using the HashRouter component instead of the Router component: React Router: Declarative Routing for React.js

If you’re using a different client-side routing library, check its documentation for details

1 Like

Daml Hub have changed our NGINX server configuration for all ledgers and we now support react routing in the UI hosted in Daml Hub.

2 Likes