Skip to content

Commit 52a7515

Browse files
authored
Revert "Deprecate http.server_host option and raise issue if used" (home-assistant#155834)
1 parent 533b9f9 commit 52a7515

File tree

4 files changed

+4
-105
lines changed

4 files changed

+4
-105
lines changed

homeassistant/components/http/__init__.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from homeassistant.core import Event, HomeAssistant, callback
3939
from homeassistant.exceptions import HomeAssistantError
4040
from homeassistant.helpers import config_validation as cv, issue_registry as ir, storage
41-
from homeassistant.helpers.hassio import is_hassio
4241
from homeassistant.helpers.http import (
4342
KEY_ALLOW_CONFIGURED_CORS,
4443
KEY_AUTHENTICATED, # noqa: F401
@@ -108,10 +107,9 @@
108107

109108
HTTP_SCHEMA: Final = vol.All(
110109
cv.deprecated(CONF_BASE_URL),
111-
cv.deprecated(CONF_SERVER_HOST), # Deprecated in HA Core 2025.11
112110
vol.Schema(
113111
{
114-
vol.Optional(CONF_SERVER_HOST): vol.All(
112+
vol.Optional(CONF_SERVER_HOST, default=_DEFAULT_BIND): vol.All(
115113
cv.ensure_list, vol.Length(min=1), [cv.string]
116114
),
117115
vol.Optional(CONF_SERVER_PORT, default=SERVER_PORT): cv.port,
@@ -209,24 +207,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
209207
if conf is None:
210208
conf = cast(ConfData, HTTP_SCHEMA({}))
211209

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
219-
ir.async_create_issue(
220-
hass,
221-
DOMAIN,
222-
issue_id,
223-
breaks_in_ha_version="2026.5.0",
224-
is_fixable=False,
225-
severity=severity,
226-
translation_key=issue_id,
227-
)
228-
229-
server_host = conf.get(CONF_SERVER_HOST, _DEFAULT_BIND)
210+
server_host = conf[CONF_SERVER_HOST]
230211
server_port = conf[CONF_SERVER_PORT]
231212
ssl_certificate = conf.get(CONF_SSL_CERTIFICATE)
232213
ssl_peer_certificate = conf.get(CONF_SSL_PEER_CERTIFICATE)

homeassistant/components/http/strings.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{
22
"issues": {
3-
"server_host_deprecated": {
4-
"description": "The `server_host` configuration option in the HTTP integration is deprecated 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.",
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 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.",
9-
"title": "The `server_host` HTTP configuration may break Home Assistant Core - Supervisor communication"
10-
},
113
"ssl_configured_without_configured_urls": {
124
"description": "Home Assistant detected that SSL has been set up on your instance, however, no custom external internet URL has been set.\n\nThis may result in unexpected behavior. Text-to-speech may fail, and integrations may not be able to connect back to your instance correctly.\n\nTo address this issue, go to Settings > System > Network; under the \"Home Assistant URL\" section, configure your new \"Internet\" and \"Local network\" addresses that match your new SSL configuration.",
135
"title": "SSL is configured without an external URL or internal URL"

tests/components/http/test_init.py

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ipaddress import ip_network
88
import logging
99
from pathlib import Path
10-
from unittest.mock import ANY, Mock, patch
10+
from unittest.mock import Mock, patch
1111

1212
import pytest
1313

@@ -667,78 +667,3 @@ async def test_ssl_issue_urls_configured(
667667
"http",
668668
"ssl_configured_without_configured_urls",
669669
) not in issue_registry.issues
670-
671-
672-
@pytest.mark.parametrize(
673-
(
674-
"hassio",
675-
"http_config",
676-
"expected_serverhost",
677-
"expected_warning_count",
678-
"expected_issues",
679-
),
680-
[
681-
(False, {}, ["0.0.0.0", "::"], 0, set()),
682-
(
683-
False,
684-
{"server_host": "0.0.0.0"},
685-
["0.0.0.0"],
686-
1,
687-
{("http", "server_host_deprecated")},
688-
),
689-
(True, {}, ["0.0.0.0", "::"], 0, set()),
690-
(
691-
True,
692-
{"server_host": "0.0.0.0"},
693-
[
694-
"0.0.0.0",
695-
],
696-
1,
697-
{("http", "server_host_deprecated_hassio")},
698-
),
699-
],
700-
)
701-
async def test_server_host(
702-
hass: HomeAssistant,
703-
hassio: bool,
704-
issue_registry: ir.IssueRegistry,
705-
http_config: dict,
706-
expected_serverhost: list,
707-
expected_warning_count: int,
708-
expected_issues: set[tuple[str, str]],
709-
caplog: pytest.LogCaptureFixture,
710-
) -> None:
711-
"""Test server_host behavior."""
712-
mock_server = Mock()
713-
with (
714-
patch("homeassistant.components.http.is_hassio", return_value=hassio),
715-
patch(
716-
"asyncio.BaseEventLoop.create_server", return_value=mock_server
717-
) as mock_create_server,
718-
):
719-
assert await async_setup_component(
720-
hass,
721-
"http",
722-
{"http": http_config},
723-
)
724-
await hass.async_start()
725-
await hass.async_block_till_done()
726-
727-
mock_create_server.assert_called_once_with(
728-
ANY,
729-
expected_serverhost,
730-
8123,
731-
ssl=None,
732-
backlog=128,
733-
reuse_address=None,
734-
reuse_port=None,
735-
)
736-
737-
assert (
738-
caplog.text.count(
739-
"The 'server_host' option is deprecated, please remove it from your configuration"
740-
)
741-
== expected_warning_count
742-
)
743-
744-
assert set(issue_registry.issues) == expected_issues

tests/scripts/test_check_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def test_secrets() -> None:
137137
"server_port": 8123,
138138
"ssl_profile": "modern",
139139
"use_x_frame_options": True,
140+
"server_host": ["0.0.0.0", "::"],
140141
}
141142
assert res["secret_cache"] == {
142143
get_test_config_dir("secrets.yaml"): {"http_pw": "http://google.com"}

0 commit comments

Comments
 (0)