Configuration changes to cache_optimistic_answer_ttl and cache_optimistic_max_age made via YAML are overwritten when saving settings via WebUI
Prerequisites
-
[x] I have checked the Wiki and Discussions and found no answer
-
[x] I have searched other issues and found no duplicates
-
[x] I want to report a bug and not ask a question or ask for help
-
[x] I have set up AdGuard Home correctly and configured clients to use it. (Use the Discussions for help with installing and configuring clients.)
Platform (OS and CPU architecture)
Linux, MIPS LE
Installation
GitHub releases or script from README
Setup
On a router, DHCP is handled by the router
AdGuard Home version
v0.107.79
Action
Modified AdGuardHome.yaml directly using WinSCP to change cache_optimistic_answer_ttl to 1h and cache_optimistic_max_age to 3h, saved the file, and then saved any settings change via the WebUI.
Expected result
The manually configured cache values in the YAML file should be respected and retained when saving configurations through the WebUI.
Actual result
Whenever any setting is saved through the WebUI, AdGuard Home overwrites those two optimistic caching fields back to their default values (1s and 3h).
Additional information and/or screenshots
Chronology / Full Step-by-Step Details:
-
I checked the initial AdGuardHome.yaml configuration and found the default optimistic caching values: cache_optimistic_answer_ttl: 1s cache_optimistic_max_age: 3h
-
I accessed the router via WinSCP, edited the AdGuardHome.yaml file directly, and manually changed the values to: cache_optimistic_answer_ttl: 1h cache_optimistic_max_age: 3h
-
I saved the file and restarted the service/router to apply changes. The values were successfully loaded and retained until the next step.
-
The issue occurs whenever I make and save ANY unrelated configuration changes through the WebUI (e.g., modifying filtering rules, clients, or general settings).
-
Upon clicking "Save" in the WebUI, AdGuard Home overwrites the YAML file, automatically reverting those two custom cache parameters back to their default values (1s and 3h). It seems the WebUI state pushes its in-memory defaults and overrides manual YAML modifications for these specific fields.
I think your mistake is to edit YAML file while AdGuardHome is started. First stop AdGuarHome service, then edit the YAML file, and finally start AdGuardHome service. This applies each time you want to manually edit YAML file, but not required if you set values and settings from WebUI.
Ah, I see! That makes total sense. Thank you for pointing that out and helping me solve the issue.
I think your mistake is to edit YAML file while AdGuardHome is started. First stop AdGuarHome service, then edit the YAML file, and finally start AdGuardHome service. This applies each time you want to manually edit YAML file, but not required if you set values and settings from WebUI.
Thank you very much for the explanation! Stopping the service before editing the YAML file solved the issue. I really appreciate your help.
The default values should be 12 hours and 30 seconds respectively- not 1 second and 3 hours respectively
Expected behavior. The wiki says to stop the service before editing AdGuardHome.yaml, because a running instance overwrites the file on save. The reporter confirmed the fix. The upstream defaults are 30s and 12h, not 1s and 3h.