docs/deploy/BASE_PATH_CONFIGURATION.md
This document describes how to configure DataHub to run from a custom base path (e.g., /my-app/ instead of /).
DataHub now supports serving from a custom base path, allowing you to:
https://company.com/datahub/)Set the following environment variable to configure the base path:
export DATAHUB_BASE_PATH="/my-app"
Important Notes:
/ but not end with //datahub, /my-app, /tools/datahubThe base path configuration affects three main components:
The frontend determines the base path using multiple detection methods (in priority order):
Environment Variable (highest priority):
# Set in .env file or environment
REACT_APP_BASE_PATH=/my-app
Server Configuration (fetched from /config endpoint):
URL Analysis (fallback):
Development Configuration:
# Method 1: Environment variable (recommended for development)
echo "REACT_APP_BASE_PATH=/my-app" >> .env
yarn start # Development server at http://localhost:3000/my-app
# Method 2: Using Vite preview (for testing production builds)
yarn build
npx vite preview --port 3001 # Uses base path from REACT_APP_BASE_PATH
# Accessible at: http://localhost:3001/my-app
# Method 3: Override base path via command line
npx vite preview --port 3001 --base /custom-path
Production Behavior:
The Play Framework application supports base path through:
datahub.basePath configuration in application.confplay.http.context for Play Framework native supportDATAHUB_BASE_PATHThe metadata service (GMS) supports base path through:
server.servlet.context-path in application.yamlDATAHUB_BASE_PATHversion: "3.8"
services:
datahub-frontend:
environment:
- DATAHUB_BASE_PATH=/datahub
- PLAY_HTTP_CONTEXT=/datahub
datahub-gms:
environment:
- DATAHUB_BASE_PATH=/datahub
apiVersion: apps/v1
kind: Deployment
metadata:
name: datahub-frontend
spec:
template:
spec:
containers:
- name: datahub-frontend
env:
- name: DATAHUB_BASE_PATH
value: "/datahub"
- name: DATAHUB_GMS_BASE_PATH
value: "/datahub"
- name: PLAY_HTTP_CONTEXT
value: "/datahub"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: datahub-gms
spec:
template:
spec:
containers:
- name: datahub-frontend
env:
- name: DATAHUB_BASE_PATH
value: "/datahub"
- name: DATAHUB_GMS_BASE_PATH
value: "/datahub"