Skip to content

Commit 07c4c58

Browse files
emontnemeryedenhausabmantis
authored
Deprecate http.server_host option and raise issue if used (home-assistant#155849)
Co-authored-by: Robert Resch <[email protected]> Co-authored-by: Abílio Costa <[email protected]>
1 parent 6a07b46 commit 07c4c58

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed

homeassistant/components/http/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108

109109
HTTP_SCHEMA: Final = vol.All(
110110
cv.deprecated(CONF_BASE_URL),
111+
cv.deprecated(CONF_SERVER_HOST), # Deprecated in HA Core 2025.12
111112
vol.Schema(
112113
{
113114
vol.Optional(CONF_SERVER_HOST): vol.All(
@@ -208,14 +209,21 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
208209
if conf is None:
209210
conf = cast(ConfData, HTTP_SCHEMA({}))
210211

211-
if CONF_SERVER_HOST in conf and is_hassio(hass):
212+
if CONF_SERVER_HOST in conf:
213+
if is_hassio(hass):
214+
issue_id = "server_host_deprecated_hassio"
215+
severity = ir.IssueSeverity.ERROR
216+
else:
217+
issue_id = "server_host_deprecated"
218+
severity = ir.IssueSeverity.WARNING
212219
ir.async_create_issue(
213220
hass,
214221
DOMAIN,
215-
"server_host_may_break_hassio",
222+
issue_id,
223+
breaks_in_ha_version="2026.6.0",
216224
is_fixable=False,
217-
severity=ir.IssueSeverity.ERROR,
218-
translation_key="server_host_may_break_hassio",
225+
severity=severity,
226+
translation_key=issue_id,
219227
)
220228

221229
server_host = conf.get(CONF_SERVER_HOST, _DEFAULT_BIND)

homeassistant/components/http/strings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"issues": {
3-
"server_host_may_break_hassio": {
4-
"description": "The `server_host` configuration option in the HTTP integration is prone to break the communication between Home Assistant Core and Supervisor, and will be removed in a future release.\n\nIf you are using this option to bind Home Assistant to specific network interfaces, please remove it from your configuration. Home Assistant will automatically bind to all available interfaces by default.\n\nIf you have specific networking requirements, consider using firewall rules or other network configuration to control access to Home Assistant.",
3+
"server_host_deprecated": {
4+
"description": "The `server_host` configuration option in the HTTP integration is deprecated and will be removed.\n\nIf you are using this option to bind Home Assistant to specific network interfaces, please remove it from your configuration. Home Assistant will automatically bind to all available interfaces by default.\n\nIf you have specific networking requirements, consider using firewall rules or other network configuration to control access to Home Assistant.",
5+
"title": "The `server_host` HTTP configuration option is deprecated"
6+
},
7+
"server_host_deprecated_hassio": {
8+
"description": "The deprecated `server_host` configuration option in the HTTP integration is prone to break the communication between Home Assistant Core and Supervisor, and will be removed.\n\nIf you are using this option to bind Home Assistant to specific network interfaces, please remove it from your configuration. Home Assistant will automatically bind to all available interfaces by default.\n\nIf you have specific networking requirements, consider using firewall rules or other network configuration to control access to Home Assistant.",
59
"title": "The `server_host` HTTP configuration may break Home Assistant Core - Supervisor communication"
610
},
711
"ssl_configured_without_configured_urls": {

tests/components/http/test_init.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,19 +683,27 @@ async def test_ssl_issue_urls_configured(
683683
"hassio",
684684
"http_config",
685685
"expected_serverhost",
686+
"expected_warning_count",
686687
"expected_issues",
687688
),
688689
[
689-
(False, {}, ["0.0.0.0", "::"], set()),
690-
(False, {"server_host": "0.0.0.0"}, ["0.0.0.0"], set()),
691-
(True, {}, ["0.0.0.0", "::"], set()),
690+
(False, {}, ["0.0.0.0", "::"], 0, set()),
691+
(
692+
False,
693+
{"server_host": "0.0.0.0"},
694+
["0.0.0.0"],
695+
1,
696+
{("http", "server_host_deprecated")},
697+
),
698+
(True, {}, ["0.0.0.0", "::"], 0, set()),
692699
(
693700
True,
694701
{"server_host": "0.0.0.0"},
695702
[
696703
"0.0.0.0",
697704
],
698-
{("http", "server_host_may_break_hassio")},
705+
1,
706+
{("http", "server_host_deprecated_hassio")},
699707
),
700708
],
701709
)
@@ -705,7 +713,9 @@ async def test_server_host(
705713
issue_registry: ir.IssueRegistry,
706714
http_config: dict,
707715
expected_serverhost: list,
716+
expected_warning_count: int,
708717
expected_issues: set[tuple[str, str]],
718+
caplog: pytest.LogCaptureFixture,
709719
) -> None:
710720
"""Test server_host behavior."""
711721
mock_server = Mock()
@@ -733,4 +743,11 @@ async def test_server_host(
733743
reuse_port=None,
734744
)
735745

746+
assert (
747+
caplog.text.count(
748+
"The 'server_host' option is deprecated, please remove it from your configuration"
749+
)
750+
== expected_warning_count
751+
)
752+
736753
assert set(issue_registry.issues) == expected_issues

0 commit comments

Comments
 (0)