~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: make web.use_https docs exact and fix get_server_url argument order (#7079)
LearningCircuit21ae8aa9ee6b
diff --git a/changelog.d/+https-setting-description.bugfix.md b/changelog.d/+https-setting-description.bugfix.mdnew file mode 100644index 0000000000..3c279aca0d--- /dev/null+++ b/changelog.d/+https-setting-description.bugfix.md@@ -0,0 +1,9 @@+The `web.use_https` (`LDR_WEB_USE_HTTPS`) description no longer claims that+the setting enables HTTPS. LDR's web listener always serves plain HTTP, so+TLS must be terminated at a reverse proxy. The setting's only visible effect+is a startup warning saying so, logged while it is true (the default).++`get_server_url()` now reads `web.host`, `web.port` and `web.use_https` from+the settings snapshot when it builds its fallback server URL. It passed the+snapshot in the `default` argument position, so the snapshot was never read.+Nothing uses that URL yet, so this has no visible effect.diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.mdindex c4b2ed51c0..572ad5927b 100644--- a/docs/CONFIGURATION.md+++ b/docs/CONFIGURATION.md@@ -682,7 +682,7 @@ They are not available in the Web UI because they are needed to start the applic| `web.enable_javascript_rendering` | `LDR_WEB_ENABLE_JAVASCRIPT_RENDERING` | `false` | When enabled, falls back to a headless browser (Crawl4AI/Playwright) for pages that need JavaScript to render. Requires Chromium to be installed - the default Docker production image does NOT include it. To enable: install Chromium in the runtime environment (e.g. 'playwright install --with-deps chromium'), then toggle this setting. Note: in our limited (mostly accidental) benchmark comparisons - between dev instances that happened to have Chromium installed and routine Docker runs that did not - JS rendering did not measurably improve research quality, and most of our regular benchmark runs are on Docker without Chromium anyway. Leave disabled unless you have a specific need to scrape JavaScript-only sites. | APP || `web.host` | `LDR_WEB_HOST` | `127.0.0.1` | The host address to listen on. Configured via LDR_WEB_HOST environment variable. Requires server restart. | APP || `web.port` | `LDR_WEB_PORT` | `5000` | The port to listen on. Configured via LDR_WEB_PORT environment variable. Requires server restart. | APP |-| `web.use_https` | `LDR_WEB_USE_HTTPS` | `true` | Whether to enable HTTPS for the web interface. Configured via LDR_WEB_USE_HTTPS environment variable. Requires server restart. | APP |+| `web.use_https` | `LDR_WEB_USE_HTTPS` | `true` | Does not enable HTTPS or configure TLS certificates: the web listener always serves plain HTTP, so terminate TLS at a reverse proxy. While this is true (the default), LDR logs a startup warning saying so; set it to false to silence the warning. Otherwise it only sets the scheme of an internal fallback server URL that nothing currently uses, so no generated link depends on it. Configured via LDR_WEB_USE_HTTPS; requires server restart. | APP || `zotero.api_key` | `LDR_ZOTERO_API_KEY` | `` | Your Zotero API key. Create one at https://www.zotero.org/settings/keys (it needs read access to the library you want to import). Not needed if 'Use Local Zotero' is enabled. | APP || `zotero.auto_sync_enabled` | `LDR_ZOTERO_AUTO_SYNC_ENABLED` | `false` | Periodically re-sync the configured collections in the background (downloads new items, updates changed ones, and removes items deleted in Zotero). Requires the Zotero integration to be enabled. | APP || `zotero.collection_keys` | `LDR_ZOTERO_COLLECTION_KEYS` | `` | Comma-separated Zotero collection keys to import (e.g. ABCD1234). Leave empty to import the entire library. Use the 'List collections' button on the Zotero page to find keys. | APP |diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex 8749e4bb63..8cc02ac2ac 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -3340,7 +3340,7 @@},"web.use_https": {"category": null,- "description": "Whether to enable HTTPS for the web interface. Configured via LDR_WEB_USE_HTTPS environment variable. Requires server restart.",+ "description": "Does not enable HTTPS or configure TLS certificates: the web listener always serves plain HTTP, so terminate TLS at a reverse proxy. While this is true (the default), LDR logs a startup warning saying so; set it to false to silence the warning. Otherwise it only sets the scheme of an internal fallback server URL that nothing currently uses, so no generated link depends on it. Configured via LDR_WEB_USE_HTTPS; requires server restart.","editable": false,"max_value": null,"min_value": null,diff --git a/src/local_deep_research/utilities/llm_utils.py b/src/local_deep_research/utilities/llm_utils.pyindex b00275862b..ede31f0270 100644--- a/src/local_deep_research/utilities/llm_utils.py+++ b/src/local_deep_research/utilities/llm_utils.py@@ -306,7 +306,8 @@ def get_server_url(settings_snapshot: Optional[Dict[str, Any]] = None) -> str:settings_snapshot: Optional settings snapshotReturns:- Server URL with trailing slash+ Server URL. URLs built in steps 3 and 4 end with a slash; a+ server_url found in steps 1 or 2 is returned as given."""server_url = None@@ -320,16 +321,25 @@ def get_server_url(settings_snapshot: Optional[Dict[str, Any]] = None) -> str:system_settings = settings_snapshot.get("system", {})server_url = system_settings.get("server_url")- # If not found, try web.host and web.port settings+ # If not found, try web.host and web.port settings. Keyword+ # arguments matter: the signature is (key, default, username,+ # settings_snapshot), so a positional snapshot became the default+ # and was never read.if not server_url:host = get_setting_from_snapshot(- "web.host", settings_snapshot, "127.0.0.1"+ "web.host",+ default="127.0.0.1",+ settings_snapshot=settings_snapshot,)port = get_setting_from_snapshot(- "web.port", settings_snapshot, 5000+ "web.port",+ default=5000,+ settings_snapshot=settings_snapshot,)use_https = get_setting_from_snapshot(- "web.use_https", settings_snapshot, True+ "web.use_https",+ default=True,+ settings_snapshot=settings_snapshot,)# Use localhost for 0.0.0.0 bindings as that's what users will usediff --git a/src/local_deep_research/web_search_engines/engines/search_engine_library.py b/src/local_deep_research/web_search_engines/engines/search_engine_library.pyindex 71acb0a5ba..dd2d28655b 100644--- a/src/local_deep_research/web_search_engines/engines/search_engine_library.py+++ b/src/local_deep_research/web_search_engines/engines/search_engine_library.py@@ -161,7 +161,9 @@ class LibraryRAGSearchEngine(BaseSearchEngine):settings_snapshot=settings_snapshot,)- # Extract server URL from settings snapshot for link generation+ # Fallback server URL from the settings snapshot (see+ # get_server_url). Nothing reads this attribute yet, so no link is+ # built from it.self.server_url = get_server_url(settings_snapshot)# Local RAG retrieval is vector-similarity ranked and can return manydiff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.jsonindex 219d873983..da17fd6f51 100644--- a/tests/settings/golden_master_settings.json+++ b/tests/settings/golden_master_settings.json@@ -9816,7 +9816,7 @@},"web.use_https": {"category": null,- "description": "Whether to enable HTTPS for the web interface. Configured via LDR_WEB_USE_HTTPS environment variable. Requires server restart.",+ "description": "Does not enable HTTPS or configure TLS certificates: the web listener always serves plain HTTP, so terminate TLS at a reverse proxy. While this is true (the default), LDR logs a startup warning saying so; set it to false to silence the warning. Otherwise it only sets the scheme of an internal fallback server URL that nothing currently uses, so no generated link depends on it. Configured via LDR_WEB_USE_HTTPS; requires server restart.","editable": false,"max_value": null,"min_value": null,diff --git a/tests/settings/test_shipped_defaults_contracts.py b/tests/settings/test_shipped_defaults_contracts.pyindex 77038ecd5b..1605e6625c 100644--- a/tests/settings/test_shipped_defaults_contracts.py+++ b/tests/settings/test_shipped_defaults_contracts.py@@ -38,6 +38,7 @@ broken, and the day it is fixed this test turns red until the marker isdeleted". Each carries the defect in its ``reason``."""+import astimport functoolsimport jsonimport os@@ -718,42 +719,62 @@ class TestSecureByDefault:assert '"app.host"' in url_builderassert '"app.port"' in url_builder- @pytest.mark.xfail(- strict=True,- reason=(- "DOCUMENTATION DEFECT: the visible app.host/app.port settings "- "claim to configure the web server bind address and TCP port, "- "but the server reads hidden web.host/web.port (or their LDR_WEB_* "- "environment variables). app.host/app.port are consumed by the "- "notification URL builder instead. The generated configuration "- "reference repeats the misleading source descriptions. Tracked "- "in #6009."- ),- )def test_notification_url_host_and_port_describe_their_actual_role(self):defaults = raw_defaults()- for key in ("app.host", "app.port"):+ for key, env_var in (+ ("app.host", "ldr_web_host"),+ ("app.port", "ldr_web_port"),+ ):description = defaults[key]["description"].lower()assert "notification" in description, key- assert "web server" not in description, key- assert "bind" not in description, key+ assert "does not control the web listener" in description, key+ assert env_var in description, key- @pytest.mark.xfail(- strict=True,- reason=(- "DOCUMENTATION DEFECT: web.use_https says it enables HTTPS, but "- "the launch path always starts a plain-HTTP uvicorn server and "- "only warns when the setting is true. The description must say "- "that TLS is terminated by a reverse proxy (and separately "- "describe any URL-construction semantics) rather than promising "- "in-process HTTPS. Tracked in #6048."- ),- )def test_web_use_https_does_not_claim_to_enable_tls(self):description = raw_defaults()["web.use_https"]["description"].lower()- assert "does not" in description- assert "https" in description- assert "reverse proxy" in description+ assert "does not enable https" in description+ assert "terminate tls at a reverse proxy" in description+ # Its only observable effect is the startup warning in web/app.py.+ assert "startup warning" in description+ assert "no generated link depends on it" in description++ def test_web_use_https_fallback_url_has_no_consumer(self):+ """Pin the code facts behind the web.use_https description.++ The description says that, apart from the startup warning, the+ setting only feeds an internal fallback URL that nothing uses.+ get_server_url() builds that URL. Its one caller stores the result+ on SearchEngineLibrary.server_url, and nothing reads that+ attribute. If either fact changes, update the description to say+ which links now use the setting, then update this test.+ """+ callers = set()+ readers = set()+ for rel_path, text in _src_texts():+ if "server_url" not in text:+ continue+ rel_path = rel_path.replace(os.sep, "/")+ if not rel_path.endswith(".py"):+ readers.add(rel_path)+ continue+ for node in ast.walk(ast.parse(text)):+ if isinstance(node, ast.Call):+ func = node.func+ name = getattr(func, "id", None) or getattr(+ func, "attr", None+ )+ if name == "get_server_url":+ callers.add(rel_path)+ elif (+ isinstance(node, ast.Attribute)+ and node.attr == "server_url"+ and isinstance(node.ctx, ast.Load)+ ):+ readers.add(rel_path)+ assert callers == {+ "web_search_engines/engines/search_engine_library.py"+ }+ assert readers == set()# ---------------------------------------------------------------------------diff --git a/tests/utilities/test_llm_utils.py b/tests/utilities/test_llm_utils.pyindex 12c22cbd80..6fc27206d5 100644--- a/tests/utilities/test_llm_utils.py+++ b/tests/utilities/test_llm_utils.py@@ -2,6 +2,8 @@from unittest.mock import Mock, patch+import pytest+from local_deep_research.utilities.llm_utils import (fetch_ollama_models,get_model_identifier,@@ -146,8 +148,12 @@ class TestGetServerUrl:with patch("local_deep_research.utilities.llm_utils.get_setting_from_snapshot") as mock_get:-- def side_effect(key, snapshot_arg=None, default=None):+ # Same parameters as the real get_setting_from_snapshot, so a+ # positional snapshot lands in `default` and fails the check.+ def side_effect(+ key, default=None, username=None, settings_snapshot=None+ ):+ assert settings_snapshot is snapshot, keysettings = {"web.host": "0.0.0.0","web.port": 8080,@@ -167,7 +173,10 @@ class TestGetServerUrl:"local_deep_research.utilities.llm_utils.get_setting_from_snapshot") as mock_get:- def side_effect(key, snapshot_arg=None, default=None):+ def side_effect(+ key, default=None, username=None, settings_snapshot=None+ ):+ assert settings_snapshot is snapshot, keysettings = {"web.host": "192.168.1.1", # Not localhost, so it won't default"web.port": 5000,@@ -179,6 +188,35 @@ class TestGetServerUrl:result = get_server_url(settings_snapshot=snapshot)assert result == "http://192.168.1.1:5000/"+ @pytest.mark.parametrize(+ ("host", "use_https", "expected"),+ [+ ("10.0.0.5", False, "http://10.0.0.5:8443/"),+ ("10.0.0.5", True, "https://10.0.0.5:8443/"),+ ("0.0.0.0", False, "http://127.0.0.1:8443/"),+ ],+ )+ def test_reads_web_settings_from_real_snapshot(+ self, monkeypatch, host, use_https, expected+ ):+ """Unmocked: the snapshot's web.* values must reach the URL.++ get_setting_from_snapshot takes (key, default, username,+ settings_snapshot). A snapshot passed positionally becomes the+ default and is never read: with no thread settings context, every+ web.* value comes back as the snapshot dict itself, so the scheme+ is always https.+ """+ for env_var in ("LDR_WEB_HOST", "LDR_WEB_PORT", "LDR_WEB_USE_HTTPS"):+ monkeypatch.delenv(env_var, raising=False)+ # Full-format entries, as SettingsManager.get_all_settings() builds.+ snapshot = {+ "web.host": {"value": host, "ui_element": "text"},+ "web.port": {"value": 8443, "ui_element": "number"},+ "web.use_https": {"value": use_https, "ui_element": "checkbox"},+ }+ assert get_server_url(settings_snapshot=snapshot) == expected+def test_priority_order(self):"""Should check server_url before system before web settings."""# Direct server_url takes prioritydiff --git a/tests/utilities/test_llm_utils_high_value.py b/tests/utilities/test_llm_utils_high_value.pyindex 3d88d56766..300c90a6cb 100644--- a/tests/utilities/test_llm_utils_high_value.py+++ b/tests/utilities/test_llm_utils_high_value.py@@ -127,7 +127,12 @@ class TestGetServerUrl:@patch("local_deep_research.utilities.llm_utils.get_setting_from_snapshot")def test_construct_from_host_port_https(self, mock_get):- def side_effect(key, default_val=None, default=None):+ # Real parameter names, so a positional snapshot lands in `default`+ # and fails the check instead of being mirrored by the mock.+ def side_effect(+ key, default=None, username=None, settings_snapshot=None+ ):+ assert settings_snapshot is snapshot, keymapping = {"web.host": "192.168.1.100","web.port": 8443,@@ -145,7 +150,10 @@ class TestGetServerUrl:@patch("local_deep_research.utilities.llm_utils.get_setting_from_snapshot")def test_construct_http_when_not_https(self, mock_get):- def side_effect(key, default_val=None, default=None):+ def side_effect(+ key, default=None, username=None, settings_snapshot=None+ ):+ assert settings_snapshot is snapshot, keymapping = {"web.host": "myhost","web.port": 3000,@@ -161,7 +169,10 @@ class TestGetServerUrl:@patch("local_deep_research.utilities.llm_utils.get_setting_from_snapshot")def test_0000_replaced_with_127001(self, mock_get):- def side_effect(key, default_val=None, default=None):+ def side_effect(+ key, default=None, username=None, settings_snapshot=None+ ):+ assert settings_snapshot is snapshot, keymapping = {"web.host": "0.0.0.0","web.port": 5000,