When a custom base path makes sense for Langfuse
Serving Langfuse under a custom base path makes sense when an organization needs Langfuse to live at a path on an existing domain, such as a path under an internal developer portal or tools host, rather than at its own subdomain. The usual drivers are network policy that allows traffic only to approved hostnames, a wildcard or single certificate that already covers the domain, or a portal that groups internal tools under one address. If none of these applies, a dedicated subdomain is the simpler choice, because it needs no custom image and no special proxy routing. The custom base path is set when the web image is built, so it is a build-time decision, not a runtime setting you can change later without rebuilding.
A subpath changes three things. First, the web image has to be built with the base path set in NEXT_PUBLIC_BASE_PATH, because the Next.js frontend bakes asset and route URLs into the build. Second, the auth callback and public URL settings, including NEXTAUTH_URL, must include the full path, so that SSO redirects and session cookies resolve correctly under that prefix. Third, the reverse proxy must forward the subpath to the Langfuse web container and, depending on how the prefix is stripped, must pass static assets and API calls through without rewriting them incorrectly. Each change has to match across the image, the environment and the proxy, and a mismatch usually shows up as blank pages, failed logins or broken API calls rather than a clear error.
Before committing, confirm the exact build argument names, the required values and whether your chosen base path is supported in the current self-hosting documentation, since this behavior is version-specific and documented in the Langfuse self-hosting docs. Ask your team who will own the custom image, because every upgrade must be rebuilt with the same base path and retested against your proxy and identity provider. That recurring rebuild is the main cost of this choice, and it is often larger than the initial routing work. If your organization cannot commit to that cycle, a subdomain avoids the ongoing maintenance entirely.
Subdomain, subpath or proxy rewrite: which option fits
This table compares three ways to publish Langfuse: its own subdomain on the default image, a subpath built into a custom web image, and a subpath created by stripping a prefix at the reverse proxy. Read each column for the image you run, the auth and cookie settings, the upgrade effort and the situations where it fits. The main takeaway is that the proxy-only column depends on behavior that must be proven in a test environment before anyone relies on it.
| Decision factor | Dedicated subdomain | Subpath with custom web image | Subpath via proxy prefix strip |
|---|---|---|---|
| Image you run | Official Langfuse web image, unchanged | Custom web image built with NEXT_PUBLIC_BASE_PATH set to the subpath | Official Langfuse web image, unchanged, if the proxy strip works end to end |
| Public URL and routing | Dedicated hostname with its own DNS record and certificate | Path under your existing domain, routed to the Langfuse web service | Path under your existing domain, with the proxy removing the prefix before forwarding |
| Auth and cookie settings | NEXTAUTH_URL set to the subdomain, cookies scoped to that host | NEXTAUTH_URL set to the full public URL including the subpath, with cookie path and callbacks checked | NEXTAUTH_URL set to the public URL with the prefix. Confirm callback URLs and cookie scope in a test environment |
| Static assets and redirects | Served from the root, so no path rewriting is needed | Built into the image for the base path | Confirm in testing: asset, redirect and API URLs may still point at the root |
| Upgrade effort | Change the image tag and follow the standard upgrade guide | Rebuild, retest and redeploy the custom image on every Langfuse release | Standard image upgrade, plus re-verifying every proxy rule and login flow after each release |
| Operational risk | Lowest, since it matches the default configuration | Medium, since you own the build and any drift from upstream | Higher until testing shows full function, since this behavior is not established by the supplied documentation |
| Fits when | You can give Langfuse its own hostname and the security team can issue a certificate | A subpath is a firm requirement and someone owns the image build and test cycle | A subpath is required, the image must stay unmodified, and testing confirms every route works |
| Question to answer first | Can DNS and certificate changes be made for a new hostname? | Who builds, signs and tests the image after each release? | Which routes, assets, redirects and login flows break when the prefix is stripped? |
How NEXT_PUBLIC_BASE_PATH and NEXTAUTH_URL change the web container
The base path is a build-time setting for the Langfuse web container. NEXT_PUBLIC_BASE_PATH is a public variable in a Next.js application, which means its value is compiled into the JavaScript and routing assets when the image is built, not read from the environment when the container starts. Changing the path later with a different runtime variable does not move the UI, so the image must be built with the subpath you intend to serve, and every environment that uses that path needs an image built for it. The browser also has to see the same path. Asset URLs, client-side routes and API calls generated by the build will point at the compiled path, so a reverse proxy that serves the app under a different prefix, or strips the prefix in a way the build did not expect, will produce broken scripts, blank pages or failed requests. Confirm the exact variable names and their behavior against the Langfuse version you deploy, because this area changes between releases and the self-hosting documentation at Langfuse self-hosting is the authoritative reference for your version.
NEXTAUTH_URL is the other half of the setup, and it must carry the full public URL including the subpath, such as the scheme, host and path the users type into the browser. The authentication layer uses this value to build callback and redirect URLs. If it names only the host, sign-in can complete at the identity provider and then send the user to a URL outside the subpath, where the session cookie is not valid. Treat this value as part of the public contract of the deployment: it should match what the reverse proxy exposes, and any change to the host or path requires a rebuild or restart check, not only an edit to the environment file. SSO callback URLs at the identity provider must be updated to the same full path. Each provider application, whether Google, Entra ID, Okta, Keycloak or another supported provider, keeps its own list of allowed redirect URIs, and a callback registered at the old root address will be rejected. Add the new callback alongside the old one during cutover, test a full sign-in in a private browser session, and remove the old entry once you have confirmed it is no longer needed.
How a browser request reaches Langfuse under a subpath
The request starts in the user's browser and reaches the corporate reverse proxy or gateway on the existing domain. The proxy matches the chosen path prefix and forwards the request to Langfuse Web, which must be built and configured for the same base path. Inside the internal trust boundary, Langfuse Web reads and writes PostgreSQL, ClickHouse, Redis or Valkey and S3-compatible blob storage, while Langfuse Worker processes asynchronous events against the same stores. Check that the proxy and the NEXT_PUBLIC_BASE_PATH build agree on the prefix, and that only the proxy is reachable from outside.
Requests enter through the proxy and reach internal stores only via Langfuse Web and Worker.
Setup sequence for a custom base path build
This sequence takes a Langfuse instance from a chosen subpath and public URL to a verified deployment where the UI, assets, API and SDK traffic all work under that prefix. Each step ends with a check so problems surface before users depend on the build.
Choose the base path and public URL
Decide the subpath, such as
/langfuse, and the full public URL users will open, including the scheme and host of the existing domain. Record the exact value, because the web image build,NEXTAUTH_URLand proxy rules must all match it character for character, including whether a trailing slash is used. Confirm that the path does not collide with routes already served by the same domain. Done when a single written note lists the path, the public URL and the host that terminates TLS.Confirm the Langfuse release to build from
Pick the exact Langfuse release tag you will build, and check the release notes and the upgrade guide for that version before writing any configuration. Confirm the PostgreSQL, ClickHouse and Redis or Valkey versions that release requires, since a custom build inherits the same data store requirements as the stock image. Record the tag in your build records. Done when the tag, its requirements and your current data store versions have been compared and any gaps are logged.
Build the web image with the base path set
Set
NEXT_PUBLIC_BASE_PATHto the chosen prefix and build the Langfuse Web image from the selected tag in your own build pipeline, so the value is compiled into the client bundle. Tag the image with a name that shows it is a custom build, and push it to a registry you control. Because the value is baked in at build time, changing the path later means building a new image. Done when the image builds without errors and its tag is recorded alongside the release tag.Configure NEXTAUTH_URL and related settings
Set
NEXTAUTH_URLto the full public URL, including the base path, and review every other setting that embeds an external URL, such as SSO callback and sign-in settings. Use the same values in the Worker configuration where the variable is read. Restart the stack with these values in place. Done when the web container starts, logs show no URL or redirect configuration errors, and a direct request to the internal address returns the expected response.Add reverse proxy routes and static asset handling
Configure the reverse proxy to forward the base path prefix to the Langfuse Web service, preserving the prefix where the application expects it, and pass WebSocket and large request headers if your proxy requires them. Add rules so static asset paths under the prefix are served from the application and cached appropriately. Test the configuration with the proxy's validation tool before reloading. Done when the UI loads through the proxy at the prefixed URL and the browser shows no 404 responses for assets.
Update identity provider callback URLs
If single sign-on is enabled, add the new callback URL, which includes the base path, to every identity provider application that signs users in to this instance, and remove obsolete entries that point to the old root URL. Confirm the provider accepts the redirect with the exact prefix and scheme. Done when each provider configuration lists the prefixed callback and a sign-in attempt reaches the instance without a redirect mismatch error.
Test login, assets, API calls and SDK ingestion
Run a tested sequence: sign in through the browser, open a project and confirm the page loads with all scripts and styles requested under the prefix, call a public API endpoint through the proxy with an API key, and send a test trace from an application SDK configured with the prefixed host. Open the trace in the UI to confirm it arrived. Keep the test results with the build record. Done when login, asset loading, an API response and a visible test trace all succeed, and any failing request is traced back to a URL, proxy rule or setting.
Where the base path change lands on each deployment target
On a single VM, the Compose file defines the Langfuse Web and Worker containers alongside PostgreSQL, ClickHouse, Redis or Valkey and blob storage. Langfuse documents this layout for testing and notes that it has no high availability, so the base path change here comes down to which web image the file references and how the host routes traffic to it. Confirm in the Langfuse self-hosting documentation whether the stock Compose file accepts a locally built web image and whether the base path build value can be passed through it.
- Image substitution: the web service points to a published image by default. Point it at a tag your pipeline pushes, and rebuild whenever the base path value changes, because the value is compiled into the frontend.
- Proxy location: a reverse proxy on the VM, such as nginx or Caddy, holds the subpath rule and forwards it to the web container port. Keep that configuration in the same repository as the Compose file.
- Environment values: set
NEXTAUTH_URLto the full public address, including the subpath, and check that the worker has the matching external address wherever it generates links. - Upgrades: pulling a new stock image replaces your custom build, so each release means rebuilding from the new source and retesting the subpath, sign-in and API routes.
Check that the rebuilt image, the proxy rule and NEXTAUTH_URL change together in one release, then test sign-in from a clean browser session.
With the Helm chart, the custom image is set through the chart's image values, and the subpath rule lives in the ingress or gateway resource in front of the web service. Langfuse documents Helm on Kubernetes as a production path, so the base path work becomes a set of values and manifests that your platform team versions and promotes like any other release. Confirm in the chart's values reference which keys set the web image repository and tag, and whether the chart exposes a path prefix setting or expects you to manage it in your own ingress object.
- Image substitution: override the web image repository and tag in your values file, and pull the image from a registry the cluster can reach.
- Routing rule: the ingress path prefix, the rewrite behavior and the TLS settings must match the base path build value exactly. A mismatch usually shows up as broken asset links rather than a clear error.
- Scaling splits: the scaling guide recommends splitting the web component into ingestion and user interface deployments under heavy load. Each deployment needs the same custom image and the same routing rule.
- Upgrades: chart and application versions move separately. Deployments using bundled data stores must move the chart from v1 to v2 before Langfuse v4, and each new chart version can change how the image values are named.
Before each upgrade, diff the chart values against the previous release and run the subpath checks in a staging namespace.
The official Terraform module for AWS provisions the cluster, databases, storage and load balancing in your account, so the base path change depends on whether the module exposes the image and routing settings you need. Your container registry, such as Amazon ECR, holds the custom web image, and the load balancer rule carries the subpath. Confirm with the module documentation whether it accepts a custom image reference and how it creates the listener or ingress rules, because a module that manages those objects for you can overwrite changes you make by hand.
- Image substitution: build the web image with the base path value, push it to your registry, and pass its reference into the module's image input if one exists.
- Routing rule: if the load balancer is created by the module, confirm whether path-based rules can be added through variables or must be added in a separate stack.
- Environment values:
NEXTAUTH_URLand the public address must agree with the DNS record and the certificate on the listener. - Upgrades: pin the module version, review its changelog for changes to ingress or image handling, and rebuild the custom image from the matching Langfuse release before applying the plan.
Run the Terraform plan against a copy of the environment first and confirm that the subpath routes still resolve after the apply.
The official Terraform module for Azure places Langfuse on AKS with Azure Database for PostgreSQL and Blob Storage. The custom web image is usually stored in Azure Container Registry, and the subpath rule sits on the ingress controller or gateway that the module or your landing zone provides. Because the networking and identity choices in an Azure subscription are often set by a central team, confirm early which components the module creates and which ones you must supply.
- Image substitution: push the base path build to your registry and confirm that the module's values or the Helm release it installs accept the image reference you need.
- Routing rule: confirm whether the ingress controller created by the module supports path prefix rules, and where those rules are declared in the module's configuration.
- Environment values: set
NEXTAUTH_URLto the public address that the gateway presents, including any certificate binding on that hostname. - Upgrades: check the module's release notes for changes to the AKS node pools, ingress and image settings, then rebuild the custom image from the same Langfuse version before the upgrade window.
Ask the module maintainer or your Azure platform team to confirm how the ingress controller and custom image are wired, then verify the subpath in a non-production subscription before promoting the change.
The official Terraform module for Google Cloud deploys Langfuse on GKE with Cloud SQL and Cloud Storage. The custom web image is stored in a registry such as Artifact Registry, and the subpath rule lives in the load balancer configuration, typically through an ingress resource on the cluster. Confirm with the module documentation how the web deployment references its image and whether the ingress definition is exposed as a variable or generated inside the module.
- Image substitution: build the web image with the base path value and push it to Artifact Registry. Pass the reference through the module's inputs, or into the Helm values the module applies.
- Routing rule: confirm whether the path prefix can be set in the ingress definition and whether the load balancer URL map needs a matching change in a separate stack.
- Environment values:
NEXTAUTH_URLmust match the hostname and subpath the load balancer serves, with a managed certificate covering that hostname. - Upgrades: review the module's changelog for changes to the load balancer or ingress, and rebuild the custom image from the matching Langfuse release before applying the plan.
Before any upgrade, confirm with your Google Cloud team that the load balancer rules, certificate and custom image change together in one change record.
Security and operational risks of serving Langfuse from a subpath
Serving Langfuse under a subpath changes how the browser, the reverse proxy and the application agree on URLs, cookies and redirects. Most of the risks below come from that mismatch, so each card names the check that confirms the two sides still agree after every build, config change or proxy edit.
Proxy rules that expose internal paths
A rule written for the subpath can accidentally forward requests for the application root, internal APIs or admin routes to the wrong upstream, or leave the Langfuse containers reachable without the proxy. Limit the proxy to the explicit paths Langfuse needs and deny everything else by default. Check the rules by requesting the internal and API paths from outside the network and confirming each one is refused or lands where you intend. The allowlist of paths should be reviewed whenever the base path or the Langfuse version changes.
Cookie scope under a shared domain
When Langfuse shares a domain with other applications, session cookies can be set with a scope wider than intended, or read by sibling apps on the same parent domain. Confirm the cookie path, domain, Secure and HttpOnly attributes in the browser after sign-in, and make sure no other application on the domain shares the cookie name. Treat the shared domain as part of Langfuse's trust boundary and document which applications run on it.
SSO callback mismatches and open redirects
The callback URL registered with the identity provider must match the public subpath URL exactly, including scheme, host and base path. A mismatch breaks login, and a loose redirect configuration can send users to attacker-controlled destinations after sign-in. Set NEXTAUTH_URL to the public address, register the exact callback URL with each identity provider, and test sign-in with a fresh browser session. Confirm which redirect targets your identity provider permits.
Authentication and SSO docsSecrets baked into the custom image
A custom web image built with a public base path must not carry secrets in build arguments, environment files or image layers, because anyone who can pull the image can read them. Keep NEXTAUTH_SECRET, database credentials and storage keys in runtime secret stores, inject them at container start, and scan the built image for leaked values before it reaches a registry. Restrict who can push to the internal registry that holds the custom build.
Testing the public URL after every change
Each rebuild, proxy edit, certificate renewal or Langfuse upgrade can change how the subpath resolves, and a passing health check on the container does not prove the public URL works. Write a short post-change test that loads the login page, signs in, creates a trace through the public ingestion endpoint and checks that static assets load from the subpath. Run it from outside your network and keep the results with the change record.
What maintaining a custom Langfuse image costs over time
A custom base path means the web image is no longer the one Langfuse publishes, so every upgrade starts with rebuilding langfuse-web from the new release with NEXT_PUBLIC_BASE_PATH set again. That rebuild is the recurring cost. After each build, someone has to retest the routes under the subpath, the static assets, the NEXTAUTH_URL callback flow and every SSO provider you enforce, then repeat the same checks for patch releases. Ask the team who will own that cycle, how many release trains per year they expect to follow, and whether the reverse proxy rules are versioned alongside the image.
Within a major version, Langfuse states that updates are non-disruptive and that database migrations run automatically at startup, so the custom image work is mostly rebuild, smoke test and rollout. A major upgrade is a different job. The v3 to v4 guide moves ClickHouse to an observations-first data model, requires ClickHouse 25.12 or later, PostgreSQL 15 or later and Redis 7.0 or later, and advises about 3x ClickHouse disk headroom when backfilling historic data. Your custom image then has to be rebuilt against a changed application, and the subpath changes must be re-verified against new data paths. Confirm the Helm chart version requirement too if you run bundled data stores.
Inside your organization, the cost is engineer time for each build, test and rollback, plus the cost of keeping someone familiar with Next.js build arguments and proxy behavior. A partner bills for the same work under a written scope, which usually covers the build pipeline, a regression checklist and the major upgrade plan. Separate one-time items (the initial build pipeline, route and SSO test suite, proxy configuration) from recurring items (per-release rebuilds, patch retests, major upgrade projects). In any quote, ask which upgrades are included, how many releases are covered, who handles rollback, whether SSO and proxy retests are included, and how a major upgrade is priced compared with a patch.
Limits to confirm in your environment before committing
A custom base path changes how Langfuse builds its web image, routes its requests and redirects users after sign-in. Each item below is a limit that depends on your Langfuse version, your proxy and your identity provider, so confirm it before you commit to a build.
Base path support by version
Confirm that the subpath you plan to use is supported by the Langfuse version you intend to run, and that the build-time setting NEXT_PUBLIC_BASE_PATH behaves the same way in that release. Path handling has changed between releases, so a path that works on one version may need rework after an upgrade. Ask the vendor, then prove it in a staging build with the exact tag you plan to deploy.
Browser SDK and API routes under the prefix
Test how the browser-facing parts of Langfuse and its API routes resolve under the prefix, including asset loading, redirects and any calls the UI makes back to the server. Confirm that SDKs configured with the base host URL reach the expected endpoints, including the OpenTelemetry ingestion path. Check this with a real trace from each SDK you use, not only by loading the login page.
Proxy header and path rewriting
Confirm that your reverse proxy or gateway can strip or preserve the prefix, forward the original host and protocol headers, and pass WebSocket or streaming requests if the UI uses them. Rewrite rules that work for / often break static assets under the subpath. Record the exact rules you need, then test each required path and both upload and download of exports.
Enterprise license for UI changes
Confirm whether any UI customization you need, such as branding or layout changes, requires an Enterprise license key. Some UI customization features are gated behind that key, so a path-only change may be free while branding work is not. Ask the vendor which features your planned changes touch before you scope the custom image.
License key docsIdentity provider callback URL
Confirm that your identity provider accepts the new callback URL built from the subpath and the value you set for NEXTAUTH_URL. Most providers require an exact match, so a missing prefix or trailing slash causes sign-in to fail. Register the callback in a staging tenant first, and confirm that any enforced SSO domain settings still apply after the change.
Questions buyers ask about a custom base path for Langfuse
Is hosting Langfuse under a subpath worth the extra build effort over a subdomain?
Usually only when a subdomain is not available. A subpath adds a custom web image and proxy rules that must be maintained for every release, while a subdomain runs the standard image with standard routing. A subpath makes sense when a corporate portal, certificate policy or cookie scope requires the URL to sit under an existing domain. Before committing, ask the platform team whether a new hostname can be issued and approved. If the only reason is how the URL looks, the recurring cost of maintaining a custom image often outweighs the benefit. Settle this first, because it changes every other line in the scope.
What drives the effort and cost of a custom Langfuse web image?
The cost comes from how many places the prefix touches and how many of them must be tested. The main drivers are:
- Build pipeline: the base path is set at build time through
NEXT_PUBLIC_BASE_PATH, so the image has to be built for that prefix and stored in a registry your team can pull from. - Routing: reverse proxy or ingress rules must send the UI, APIs, static assets and any WebSocket traffic under the prefix.
- Authentication:
NEXTAUTH_URLand every identity provider callback URL must include the prefix. - Verification: login, SSO, SDK ingestion, exports and prompt management all need checks under the new path.
In a written scope, ask which routes and environments are tested, who signs off, and how the build pipeline is handed over.
How much work does each Langfuse upgrade add when the image is customized?
Each release means rebuilding the custom image, repeating the prefix tests and reviewing upstream changes that touch routing or authentication. Within a major version, Langfuse states that updates are non-disruptive and apply database migrations automatically at startup, but the custom image still has to be rebuilt and checked. Major upgrades follow dedicated migration guides and change infrastructure. For example, the v3 to v4 guide requires ClickHouse 25.12 or later, PostgreSQL 15 or later and Redis 7.0 or later. Ask for a per-release runbook and a clear statement of which upgrades are in scope for a fixed fee and which fall under a retainer.
What must our internal team supply for a subpath deployment?
Your team supplies access and decisions that a partner cannot make alone. You will need:
- Reverse proxy or ingress access to add path rules, TLS termination and header forwarding for the prefix.
- Identity provider admin rights to register redirect URIs that include the prefix.
- A build pipeline or container registry where the custom image can be built, scanned and pulled.
- DNS and certificate control for the existing domain.
- A test environment and a named approver for each release.
Confirm these owners and approval steps in the written scope so that delays during build do not come from missing access.
Can a partner own the custom image and its upgrades over the long term?
Yes, if the ownership model is written into the scope. Most engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as retainers. A clear handover should include the Dockerfile and build scripts, the pipeline definition, the proxy configuration, a runbook for each release and the list of tests that prove the prefix works. Decide who holds registry credentials and signing keys, and who approves production changes. Also ask Langfuse whether vendor support covers a modified image, since the Enterprise support plan is priced separately and the terms should be confirmed directly with the vendor.
Should a Langfuse instance with a custom base path run on a single VM or Kubernetes?
For production, Kubernetes is the better base when availability matters, because Langfuse documents Docker Compose on a single VM for testing with no high availability, and documents Kubernetes with Helm or Terraform-based deployments for production. The subpath works on either platform, but the routing lives in different places: a reverse proxy in front of a VM, or ingress path rules on Kubernetes. A custom image also needs a registry and deployment pipeline that fit the platform. Choose the platform first, then design the path rules around it. The Langfuse self-hosting documentation lists the supported deployment options.
How DeployOpen scopes and supports a Langfuse subpath deployment
DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure. For a Langfuse instance served under a custom base path, that means agreeing the routing, build and upgrade decisions in writing before any work starts, then handing over the image build and proxy configuration so your team can maintain them.
How we scope
- Confirm which subpath and parent domain Langfuse will sit under, and which other applications already use that domain.
- Record whether the web image will be rebuilt with a custom base path and who will own each rebuild.
- Agree in writing the deliverables, timeline and fixed scope, with ongoing support offered as a retainer if you want it.
How we build
- Build the Langfuse web image with the agreed base path setting and check that asset and API URLs resolve under the subpath.
- Write the NEXTAUTH_URL and related settings and test sign-in, SSO callbacks and redirects against the public address.
- Configure reverse proxy rules for the subpath and test them alongside the existing routes of the parent domain.
How we hand over
- Document the image build steps, the build arguments used and the exact proxy configuration, so your team can reproduce them.
- Provide a written upgrade procedure that lists what must be rebuilt and retested when you move to a newer Langfuse release.
- Walk your platform and security teams through the setup and the verification checks they can rerun themselves.
How we support
- Retest the custom image and proxy rules after each Langfuse upgrade you plan, before the change reaches production.
- Review the cost of keeping a custom image current, including rebuild effort per release, as part of the retainer scope.
- Offer continuous testing of the deployment as a retainer if your security team wants periodic checks of the public path.

