Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

fix: restore DNS behavior from 2.0.0 (#7207)

Thomas829da5d49ae5
diff --git a/apps/docs/docs/advanced/environment-variables/index.mdx b/apps/docs/docs/advanced/environment-variables/index.mdx
index 1a0968040..0079decee 100644
--- a/apps/docs/docs/advanced/environment-variables/index.mdx
+++ b/apps/docs/docs/advanced/environment-variables/index.mdx
@@ -36,7 +36,7 @@ Using the `PUID` and `PGID` will require you to set the correct permissions on t
| `LOG_LEVEL` | Log level to use | `debug` / `info` / `warn` / `error` | `info` |
| `BASE_URL` | Canonical public Homarr origin for MCP OAuth metadata, origin checks and secure cookies. An HTTPS origin is required behind TLS-terminating proxies, even when they forward the public host and scheme. | HTTP(S) origin without a path | - |
| `NO_EXTERNAL_CONNECTION` | Disables Homarr's internet-backed requests, including update checks, weather, location search, and RSS feeds | `true` or `false` | `false` |
-| `ENABLE_DNS_CACHING` | Opt-in DNS cache. Keep disabled for Docker service names and `extra_hosts`; cached addresses can survive container recreation and DNS-first lookup can override hosts-file entries. | `true` or `false` | `false` |
+| `ENABLE_DNS_CACHING` | Enables DNS caching. Set to `false` to use native DNS for changing Docker service addresses or `extra_hosts` overrides. | `true` or `false` | `true` |
| `HOMARR_DISABLE_IPV6` | Disables the IPv6 listener of the internal nginx proxy, even when the host supports IPv6. IPv6 is normally disabled automatically when the host has no IPv6 configured. See [#4596](https://github.com/homarr-labs/homarr/issues/4596) | `true` or `false` | `false` |
| `HOMARR_TRUSTED_PROXIES` | External proxy peers allowed to supply client identity to bundled nginx. Use exact addresses or narrow CIDRs; every trusted hop must sanitize or append its actual TCP peer. See [Trusted request identity](/docs/advanced/proxy#trusted-request-identity). | Comma-separated IP addresses/CIDRs | None |
| `HOMARR_REQUEST_IDENTITY_SECRET` | Authenticates a non-container deployment's trusted proxy identity headers. Keep private; bundled startup generates its own value. See [Trusted request identity](/docs/advanced/proxy#trusted-request-identity). | 64-character hex secret | None outside the container |
diff --git a/packages/core/src/infrastructure/dns/env.ts b/packages/core/src/infrastructure/dns/env.ts
index 96dd526b8..2bc3abf38 100644
--- a/packages/core/src/infrastructure/dns/env.ts
+++ b/packages/core/src/infrastructure/dns/env.ts
@@ -2,7 +2,7 @@ import { createBooleanSchema, createEnv } from "../env";
export const dnsEnv = createEnv({
server: {
- ENABLE_DNS_CACHING: createBooleanSchema(false),
+ ENABLE_DNS_CACHING: createBooleanSchema(true),
},
experimental__runtimeEnv: process.env,
});
diff --git a/packages/core/src/infrastructure/dns/init.ts b/packages/core/src/infrastructure/dns/init.ts
index 20055fd00..0aaf53c68 100644
--- a/packages/core/src/infrastructure/dns/init.ts
+++ b/packages/core/src/infrastructure/dns/init.ts
@@ -15,8 +15,6 @@ declare global {
const logger = createLogger({ module: "dns" });
if (dnsEnv.ENABLE_DNS_CACHING) {
- // Opt-in only: cached addresses can outlive Docker service endpoints, and
- // DNS-first resolution does not preserve /etc/hosts precedence.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
global.homarr ??= {};
global.homarr.dnsCacheManager ??= new DnsCacheManager({
diff --git a/packages/core/src/test/infrastructure/dns/init.spec.ts b/packages/core/src/test/infrastructure/dns/init.spec.ts
index 419639b28..d75232dc5 100644
--- a/packages/core/src/test/infrastructure/dns/init.spec.ts
+++ b/packages/core/src/test/infrastructure/dns/init.spec.ts
@@ -26,8 +26,8 @@ afterEach(() => {
vi.unstubAllEnvs();
});
-test.each([undefined, "false"])(
- "preserves native address-family filtering with DNS caching set to '%s'",
+test.each(["false"])(
+ "preserves native address-family filtering with DNS caching explicitly set to '%s'",
async (value) => {
vi.stubEnv("ENABLE_DNS_CACHING", value);
await import("@homarr/core/infrastructure/dns/init");
@@ -47,8 +47,8 @@ test.each([undefined, "false"])(
},
);
-test("still enables DNS caching when explicitly requested", async () => {
- vi.stubEnv("ENABLE_DNS_CACHING", "true");
+test.each([undefined, "true"])("enables DNS caching with the setting '%s'", async (value) => {
+ vi.stubEnv("ENABLE_DNS_CACHING", value);
await import("@homarr/core/infrastructure/dns/init");
expect(dns.lookup).not.toBe(nativeLookup);
expect(dns.promises.lookup).not.toBe(nativePromiseLookup);