From b2353e526da6a73d414e68bd3845fbbfd1bfe7ae Mon Sep 17 00:00:00 2001 From: Jonas Meyer-Ohle <19151471+jonas-meyer@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:24:27 +0000 Subject: [PATCH 1/3] feat: add support for custom sub-path in BrowserRouter --- ui/frontend/src/App.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/frontend/src/App.tsx b/ui/frontend/src/App.tsx index 7dd9f8174..c0b0f5b68 100644 --- a/ui/frontend/src/App.tsx +++ b/ui/frontend/src/App.tsx @@ -28,6 +28,7 @@ import { UserContext } from "./auth/Login"; import { LocalAccount } from "./auth/LocalAccount"; export const localMode = process.env.REACT_APP_AUTH_MODE === "local"; +export const subPath = process.env.REACT_APP_HAMILTON_SUB_PATH || "" const useAuthInfoBasedOnProcEnv = () => { if (localMode) { @@ -99,7 +100,7 @@ export const App = () => { includeHelp: true, }} > - + {localMode && ( } /> From 215cdf49d07d7c53f0ee0f61c09561b4be7f65c5 Mon Sep 17 00:00:00 2001 From: Jonas Meyer-Ohle <19151471+jonas-meyer@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:31:58 +0000 Subject: [PATCH 2/3] chore: add documentation for ui subpath configuration --- docs/hamilton-ui/ui.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/hamilton-ui/ui.rst b/docs/hamilton-ui/ui.rst index c1db0bed0..fedaa85d9 100644 --- a/docs/hamilton-ui/ui.rst +++ b/docs/hamilton-ui/ui.rst @@ -118,6 +118,11 @@ Self-Hosting If you know docker, you should be good to go. The one environment variable to know is `HAMILTON_ALLOWED_HOSTS`, which you can set to `*` to allow all hosts, or a comma separated list of hosts you want to allow. +To host the UI on a subpath, set `REACT_APP_HAMILTON_SUB_PATH` to the subpath required. For example, to run on `https://domain.com/hamilton`: + +.. code-block:: yaml + - REACT_APP_HAMILTON_SUB_PATH=/hamilton + Please reach out to us if you want to deploy on your own infrastructure and need help - `join slack `_. More extensive self-hosting documentation is in the works, e.g. Snowflake, Databricks, AWS, GCP, Azure, etc.; we'd love a helm chart contribution! From c842283efb22b10d4d8503d178f4e5a8f0b5c4b9 Mon Sep 17 00:00:00 2001 From: Jonas Meyer-Ohle <19151471+jonas-meyer@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:46:11 +0000 Subject: [PATCH 3/3] docs: clarify subpath environment variable requirement --- docs/hamilton-ui/ui.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/hamilton-ui/ui.rst b/docs/hamilton-ui/ui.rst index fedaa85d9..fb204f9a4 100644 --- a/docs/hamilton-ui/ui.rst +++ b/docs/hamilton-ui/ui.rst @@ -121,8 +121,11 @@ a comma separated list of hosts you want to allow. To host the UI on a subpath, set `REACT_APP_HAMILTON_SUB_PATH` to the subpath required. For example, to run on `https://domain.com/hamilton`: .. code-block:: yaml + - REACT_APP_HAMILTON_SUB_PATH=/hamilton +Make sure that the sub path environment variable begins with `/` if set. + Please reach out to us if you want to deploy on your own infrastructure and need help - `join slack `_. More extensive self-hosting documentation is in the works, e.g. Snowflake, Databricks, AWS, GCP, Azure, etc.; we'd love a helm chart contribution!