Volker Lorrmann
03/24/2025, 6:04 PMREACT_APP_HAMILTON_SUB_PATH.
https://hamilton.dagworks.io/en/latest/hamilton-ui/ui/#self-hosting
I wonder what my nginx conf should look like for the subpath /hamilton .
IΒ΄ve tried:
...
location /hamilton/ {
proxy_pass <http://frontend:8242>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
...
But this does not work. It failes, because https://domain.com/static/js/main.77c4424c.js is not found.
Note: I have also asked for help here, as this might be of interested for others: https://github.com/DAGWorks-Inc/hamilton/pull/1284#issuecomment-2749049751Stefan Krawczyk
03/24/2025, 6:27 PM/ ? (just a quick thought)Volker Lorrmann
03/24/2025, 6:29 PMlocation /hamilton and location /hamilton/ ?Stefan Krawczyk
03/24/2025, 6:31 PMVolker Lorrmann
03/24/2025, 6:37 PM# Top-level context
worker_processes auto;
events {
worker_connections 1024;
}
http {
server {
listen 8242 ssl;
server_name my-domain.com;
ssl_certificate /etc/ssl/my-domain.cer;
ssl_certificate_key /etc/ssl/my-domain.key;
location / {
proxy_pass <http://frontend:8242>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl;
server_name my-domain.com;
ssl_certificate /etc/ssl/my-domain.cer;
ssl_certificate_key /etc/ssl/my-domain.key;
# Hamilton
location /hamilton/ {
proxy_pass <http://frontend:8242>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#error_page 401 /custom401.html;
}
}
}
And this are the environment variables from my docker-compose.yml
environment:
- NGINX_PORT=8242
- NODE_ENV=development
- REACT_APP_AUTH_MODE=local
- REACT_APP_USE_POSTHOG=false
- REACT_APP_API_URL=<http://backend:8241>
- REACT_APP_HAMILTON_SUB_PATH=/hamiltonStefan Krawczyk
03/24/2025, 7:30 PM<https://domain.com/hamilton/static/js/main.77c4424c.js> would work, right?Stefan Krawczyk
03/24/2025, 7:30 PMlocation /hamilton/ {
proxy_pass <http://frontend:8242>;
should be:
location /hamilton/ {
proxy_pass <http://frontend:8242/hamilton/>;
but I don't recall nginx config details -- and it might be that nginx is removing the /hamilton/ from the URL?Volker Lorrmann
03/24/2025, 7:39 PMREACT_APP_HAMILTON_SUB_PATH is not used by hamilton frontend? That would also explain, why I can still access hamilton frontend via https://domain.com:8242Stefan Krawczyk
03/24/2025, 7:42 PMVolker Lorrmann
03/24/2025, 7:45 PMdocker-compose pull; docker-compose down; docker-compose up -dStefan Krawczyk
03/24/2025, 7:51 PMVolker Lorrmann
03/24/2025, 7:58 PMStefan Krawczyk
03/24/2025, 8:37 PMBtw, does hamilton ui has its own nginx βbuild inβ? I have my own nginx (which uses the posted config) running.yes it does
Stefan Krawczyk
03/24/2025, 8:38 PMVolker Lorrmann
03/24/2025, 9:14 PMStefan Krawczyk
03/24/2025, 9:53 PMStefan Krawczyk
03/25/2025, 6:20 AMVolker Lorrmann
03/25/2025, 6:49 AMVolker Lorrmann
03/25/2025, 6:59 AMJonas Meyer-Ohle
03/25/2025, 10:10 AMJonas Meyer-Ohle
03/25/2025, 10:27 AMENV REACT_APP_AUTH_MODE=${REACT_APP_AUTH_MODE}
ENV REACT_APP_USE_POSTHOG=${REACT_APP_USE_POSTHOG}
ENV REACT_APP_API_URL=${REACT_APP_API_URL}
ENV NODE_OPTIONS="--max-old-space-size=8192"
I'm not the biggest expert on docker, but any envs passed through docker compose should just be picked up by the individual containers right? If required I can make a fix to add REACT_APP_HAMILTON_SUB_PATH there as well though.Volker Lorrmann
03/25/2025, 10:32 AMJonas Meyer-Ohle
03/25/2025, 10:36 AMVolker Lorrmann
03/25/2025, 10:36 AMVolker Lorrmann
04/02/2025, 7:11 PMStefan Krawczyk
04/02/2025, 7:36 PMStefan Krawczyk
04/03/2025, 6:17 AMStefan Krawczyk
04/03/2025, 6:34 AMREACT_APP_HAMILTON_SUB_PATH appropriately -- see the PR.Jonas Meyer-Ohle
04/03/2025, 10:25 AMStefan Krawczyk
04/03/2025, 5:10 PMVolker Lorrmann
05/28/2025, 9:21 AMREACT_APP_HAMILTON_SUB_PATH=/hamilton
And this in my nginx.conf:
...
upstream frontend {
server frontend:8242 fail_timeout=0;
keepalive 20;
}
# Hamilton
location /hamilton/ {
proxy_pass <http://frontend/hamilton/>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
...Stefan Krawczyk
05/28/2025, 4:39 PMproxy_pass http://frontend/hamilton/;I assume that resolves correctly, right?
Stefan Krawczyk
05/28/2025, 4:46 PMREACT_APP_HAMILTON_SUB_PATH=/hamilton
5. start things up using ./run.sh
6. then navigate to <http://localhost:8242/hamilton/dashboard/projects>Volker Lorrmann
05/28/2025, 4:49 PMStefan Krawczyk
05/28/2025, 4:51 PM