Skip to content

Commit e9a7f0f

Browse files
Allow support for a root path
1 parent 311b5b3 commit e9a7f0f

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/backend/base/langflow/main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,17 @@ def create_app():
151151
from langflow.utils.version import get_version_info
152152

153153
__version__ = get_version_info()["version"]
154+
root_path = os.environ.get("LANGFLOW_ROOT_PATH", "")
154155

155156
configure()
156157
lifespan = get_lifespan(version=__version__)
157-
app = FastAPI(lifespan=lifespan, title="Langflow", version=__version__)
158+
app = FastAPI(
159+
lifespan=lifespan,
160+
title="Langflow",
161+
version=__version__,
162+
root_path=root_path
163+
)
164+
158165
app.add_middleware(
159166
ContentSizeLimitMiddleware,
160167
)

src/frontend/src/routes.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const DeleteAccountPage = lazy(() => import("./pages/DeleteAccountPage"));
4444
// const PlaygroundPage = lazy(() => import("./pages/Playground"));
4545

4646
const SignUp = lazy(() => import("./pages/SignUpPage"));
47+
const rootPath = process.env.LANGFLOW_ROOT_PATH || "";
4748
const router = createBrowserRouter(
4849
createRoutesFromElements([
4950
<Route
@@ -237,7 +238,7 @@ const router = createBrowserRouter(
237238
<Route path="*" element={<CustomNavigate replace to="/" />} />
238239
</Route>,
239240
]),
240-
{ basename: BASENAME || undefined },
241+
{ basename: rootPath || BASENAME },
241242
);
242243

243244
export default router;

src/frontend/vite.config.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default defineConfig(({ mode }) => {
3030
}, {});
3131

3232
return {
33-
base: BASENAME || "",
33+
base: env.LANGFLOW_ROOT_PATH || BASENAME || "",
3434
build: {
3535
outDir: "build",
3636
},
@@ -40,6 +40,7 @@ export default defineConfig(({ mode }) => {
4040
env.ACCESS_TOKEN_EXPIRE_SECONDS,
4141
),
4242
"process.env.CI": JSON.stringify(env.CI),
43+
"process.env.LANGFLOW_ROOT_PATH": JSON.stringify(env.LANGFLOW_ROOT_PATH),
4344
},
4445
plugins: [react(), svgr(), tsconfigPaths()],
4546
server: {

0 commit comments

Comments
 (0)