Configuration

Environment variables

Reference for the runtime and build time environment variables you can set to configure a self-hosted Umami installation.

You can configure Umami with the use of environment variables. They go into the same .env file as your DATABASE_URL.


Runtime variables#

Runtime variables are recognized when Umami is running. You can set your environment variables prior to starting the application.

APP_SECRET#

v1.0.0

Required. A random string used to secure authentication tokens. Each installation should have a unique value. You can generate one with:

Required since v3.5.0

Earlier versions fell back to DATABASE_URL when APP_SECRET was not set. That fallback has been removed. An empty value or the placeholder replace-me-with-a-random-string is now rejected.

The secret signs login tokens and is part of how anonymous session IDs are generated. If you set a new value, everyone is signed out. Visitors already seen in the current salt period are also counted as new sessions. To upgrade an installation that never set APP_SECRET without either effect, set APP_SECRET to the exact value of your DATABASE_URL. Umami then derives the same secret it used before.

CLIENT_IP_HEADER#

v1.24.0

HTTP header to check for the client's IP address. This is useful when you're behind a proxy that uses non-standard headers. If you're behind multiple proxies, see TRUSTED_PROXIES.

COLLECT_API_ENDPOINT#

v1.34.0

Allows you to send metrics to a location different than the default /api/send. This is to help you avoid some ad blockers.

CORS_MAX_AGE#

v2.0.0

How many seconds a CORS preflight should last. Default is 24 hours.

DATABASE_URL#

v1.0.0

Connection string for your database. This is the only required variable.

DEBUG#

v2.0.0

Console logging for specific areas of the application. Values include umami:auth, umami:clickhouse, umami:kafka, umami:middleware, and umami:prisma.

DISABLE_BOT_CHECK#

v2.0.0

By default bots are excluded from statistics. This disables checking for bots.

DISABLE_LOGIN#

v1.26.0

Disables the login page for the application.

DISABLE_TELEMETRY#

v2.0.0

Umami collects completely anonymous telemetry data in order to help improve the application. You can choose to disable this if you don't want to participate.

DISABLE_UPDATES#

v1.33.0

Disables the check for new versions of Umami.

ENABLE_CLIENT_SALT#

v3.5.0

Accepts a session salt sent by the tracker with data-salt or data-salt-rotation. The client salt is mixed into the server salt set by SALT_ROTATION rather than replacing it, so it can only split sessions further. Without this variable, client salts are ignored.

ENABLE_TEST_CONSOLE#

v2.0.0

Enables the internal test page, {host}/console. Admin access is required. Users can manually fire pageviews and events to their websites.

ERRORS_PER_MINUTE#

v3.5.0

The maximum number of error tracking requests accepted per website per minute. Requests over the limit return 429 and the tracker pauses capture. Retries count toward the limit. Accepts 1 to 100000. Defaults to 120.

FAVICON_URL#

v2.18.0

The URL of the service for displaying website icons.

The default is icons.duckduckgo.com:

Some alternatives you can use:

GEO_DATABASE_URL#

v2.0.0

The URL for downloading a MaxMind-compatible GeoIP database in MMDB format. This is used for IP-based location detection when location headers from a CDN are not available.

HOSTNAME / PORT#

v1.0.0

If you are running on an environment which requires you to bind to a specific hostname or port, such as Heroku, you can add these variables and start your app with pnpm run start:env instead of pnpm start.

IGNORE_ASN#

v3.6.0

You can provide a comma-delimited list of autonomous system numbers (ASNs) to exclude from data collection. Use this to block traffic from networks such as cloud hosting providers, where automated browsers often appear as ordinary visitors. Values can be written with or without the AS prefix.

The lookup uses the GeoLite2-ASN database, which is downloaded at build time alongside the location database. Blocking a hosting provider's ASN may also exclude real visitors who use a VPN or proxy on that network.

IGNORE_IP#

v1.0.0

You can provide a comma-delimited list of IP addresses and CIDR ranges to exclude from data collection.

LOG_QUERY#

v2.0.0

If you are running in development mode, this will log database queries to the console for debugging.

MCP_ENABLED#

v3.4.0

Enables the remote Model Context Protocol (MCP) endpoint at /mcp. Disabled by default.

PRIVATE_MODE#

v2.11.0

Disables all external network calls. Note, this will also disable all website icons since they come from duckduckgo.com.

REDIS_URL#

v3.0.1

Optional Redis connection string used for caching and coordination features. If omitted, Redis-backed features stay disabled.

REMOVE_TRAILING_SLASH#

v1.26.0

Removes the trailing slash from all incoming URLs.

SALT_ROTATION#

v3.1.0

Controls how often the anonymous session salt rotates for generated session identifiers. When the salt rotates, a returning visitor gets a new session ID. The default is month.

ValueBehavior
day or dailyRotates at the start of each day (UTC).
week or weeklyRotates at the start of each week (UTC).
month or monthlyRotates at the start of each month (UTC). This is the default.
Any other valueUses a fixed salt derived from that value, so the salt never rotates. Available since v3.5.0.

The daily, weekly, and monthly aliases and fixed salts were added in v3.5.0. To let the tracker add its own salt on top of this one, see ENABLE_CLIENT_SALT.

SKIP_LOCATION_HEADERS#

v2.15.0

Skips using known location headers for country/region/city detection and forces using the local geo database.

This is useful in environments where only the country (without region or city) header is set from the proxy or CDN (like Cloudflare’s CF-IPCountry when Network > IP Geolocation is switched to On).

TRACKER_SCRIPT_NAME#

v1.26.0

Allows you to assign a custom name to the tracker script different from the default script.js. This is to help you avoid some ad blockers.

The .js extension is not required. The value can also be any path you choose, for example /path/to/tracker.

TRUSTED_PROXIES#

v3.5.0

A comma-delimited list of IP addresses and CIDR ranges of the proxies and load balancers in front of Umami. Set this when requests pass through more than one proxy and Umami records an internal address (like 10.0.0.8) instead of the visitor's IP.

Without it, Umami uses the leftmost address in X-Forwarded-For or Forwarded, which a client can set to anything. When set, Umami reads X-Forwarded-For and Forwarded from right to left, skips trusted proxies, and uses the first address that isn't one. Headers such as X-Real-IP that contain a trusted proxy address are skipped in favor of the next header.

You can also use the presets loopback (127.0.0.0/8, ::1/128), linklocal (169.254.0.0/16, fe80::/10), and private (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7). Invalid entries are ignored.

Only list addresses that belong to your own proxies. If your visitors also use private addresses, such as on an internal network, list the specific proxy addresses rather than using private, otherwise those visitors will be skipped.

TWO_FACTOR_ENCRYPTION_KEY#

v3.3.0

A 64-character hex string (256-bit key) used to encrypt two-factor authentication secrets. Required before any user can enable 2FA. You can generate one with:

USE_UUIDV7#

v3.0.2

Uses UUIDv7 instead of UUIDv4 for generated random identifiers. Deterministic IDs derived from analytics data are unchanged.


Build time variables#

Build time variables are only recognized during the build process. This also includes building custom Docker images. You need to set your environment variables prior to building the application.

ALLOWED_FRAME_URLS#

v2.3.0

A space-delimited list of URLs allowed to host the application in an iframe.

BASE_PATH#

v1.9.0

Use this if you want to host Umami under a subdirectory. You may need to update your reverse proxy settings to correctly handle the BASE_PATH prefix.

BUILD_GEO#

v3.0.0

Run the local GeoIP database setup step even in a Vercel environment.

DATABASE_TYPE#

v2.0.0

The type of DB to be used. This is only required for the Docker build.

DEFAULT_CURRENCY / DEFAULT_LOCALE#

v3.1.0

Sets the default currency and locale used by the application UI before a user chooses their own preferences.

DIRECT_DATABASE_URL#

v3.2.0

Direct PostgreSQL connection string used for Prisma migrations during check-db. This is useful when DATABASE_URL points to a pooled connection that should not be used for migration commands.

FORCE_SSL#

v1.0.0

This will send an HTTP Strict-Transport-Security response header with all requests. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security.

SKIP_BUILD_GEO#

v3.1.0

Skips the local GeoIP database setup step in the build process.

SKIP_DB_CHECK#

v2.0.0

Skips the check-db step in the build process. Used for Docker builds.

SKIP_DB_MIGRATION#

v2.0.0

Skips the Prisma migration step in the build process. Setting SKIP_DB_CHECK also skips this step.