Skip to content

Ingress incorrectly adds Content-Encoding: deflate breaking streaming responses #6470

@tomquist

Description

@tomquist

Describe the issue you are experiencing

The Supervisor ingress proxy incorrectly adds Content-Encoding: deflate to streaming responses when the original browser request contains Accept-Encoding: gzip, deflate, br, zstd headers, even when the add-on returns uncompressed content. This breaks Server-Sent Events (SSE) and chunked streaming because browsers buffer the entire response to decompress it, only delivering data after the connection closes.

Root cause:

In supervisor/api/ingress.py, the _response_header() function strips Content-Encoding from the add-on's response:

def _response_header(response: aiohttp.ClientResponse) -> CIMultiDict[str]:
    for name, value in response.headers.items():
        if name in (hdrs.CONTENT_ENCODING, ...):
            continue  # Strips Content-Encoding from add-on response
        headers.add(name, value)

Then in _handle_request(), when creating a web.StreamResponse, aiohttp's automatic compression middleware sees the original Accept-Encoding header and automatically adds Content-Encoding: deflate even though the actual body from the add-on is uncompressed:

response = web.StreamResponse(status=result.status, headers=headers)
response.content_type = content_type
await response.prepare(request)  # aiohttp adds Content-Encoding: deflate here

Impact:

When browsers receive Content-Encoding: deflate, they buffer the entire response to decompress it, even though the content is not actually compressed. This means:

  • SSE events only appear after the connection closes (not in real-time)
  • Chunked streaming responses don't stream - they arrive all at once at the end
  • Real-time interactive features (chat, progress updates, etc.) are completely broken

The Accept-Encoding header is fully controlled by the browser, so there is no workaround I'm aware of.

What type of installation are you running?

Home Assistant Supervised

Which operating system are you running on?

Home Assistant Operating System

Steps to reproduce the issue

  1. Create an add-on that serves SSE (Server-Sent Events) or chunked streaming responses
  2. Configure the add-on with nginx that explicitly disables compression (gzip off;)
  3. Configure the add-on to use ingress
  4. Open the add-on UI in a browser (which sends Accept-Encoding: gzip, deflate, br, zstd)
  5. Connect to an SSE endpoint or streaming endpoint
  6. Observe that data only appears after the connection closes, not in real-time as chunks arrive
  7. Browser Network tab shows Content-Encoding: deflate but content is not actually compressed.
  8. No SSE events arrive until the connection is closed, at which points all events arrive at the same time

Anything in the Supervisor logs that might be useful for us?

No specific errors logged - the issue is silent but breaks streaming functionality completely.

System information

System Information

version core-2026.2.0.dev202601060246
installation_type Home Assistant Supervised
dev true
hassio true
docker true
container_arch aarch64
user root
virtualenv false
python_version 3.13.11
os_name Linux
os_version 6.12.54-linuxkit
arch aarch64
timezone Europe/Berlin
config_dir /config
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os null
update_channel dev
supervisor_version supervisor-2026.01.0.dev0601
agent_version 1.6.0
docker_version 29.1.3
disk_total 910.7 GB
disk_used 197.7 GB
nameservers
healthy true
supported failed to load: Unsupported
host_connectivity null
supervisor_connectivity true
ntp_synchronized null
virtualization null
supervisor_api ok
version_api ok
installed_addons OpenCode Manager (latest)
Dashboards
dashboards 2
resources 0
views 0
mode storage
Network Configuration
adapters lo (disabled), eth0 (enabled, default, auto), docker0 (disabled), hassio (disabled), veth684358c (disabled), veth9e82aa0 (disabled), veth1ced439 (disabled), veth16e6297 (disabled), vethdca2e1a (disabled), vethd408f9c (disabled)
ipv4_addresses lo (127.0.0.1/8), eth0 (172.17.0.2/16), docker0 (172.18.0.1/16), hassio (172.30.32.1/23), veth684358c (), veth9e82aa0 (), veth1ced439 (), veth16e6297 (), vethdca2e1a (), vethd408f9c ()
ipv6_addresses lo (::1/128), eth0 (), docker0 (fe80::b082:b9ff:fe7c:5ae5/64), hassio (fd0c:ac1e:2100::1/48, fe80::f81e:abff:feec:41dc/64), veth684358c (fe80::58e6:3bff:fe70:c5f0/64), veth9e82aa0 (fe80::bc4e:b9ff:fea6:2934/64), veth1ced439 (fe80::34b5:56ff:fe50:30cd/64), veth16e6297 (fe80::50da:f4ff:fedb:ad64/64), vethdca2e1a (fe80::f4d0:aaff:fe51:ee2f/64), vethd408f9c (fe80::3452:bcff:feba:4d54/64)
announce_addresses 172.17.0.2
Recorder
oldest_recorder_run January 6, 2026 at 9:26 PM
current_recorder_run January 6, 2026 at 10:26 PM
estimated_db_size 0.58 MiB
database_engine sqlite
database_version 3.49.2

Supervisor diagnostics

config_entry-hassio-01KEAK98JAX5YQF8K1X391DAS8.json

Additional information

Context: I'm building an Add-On that spins up a headless OpenCode server with a web interface to use AI to assist in writing config files. There were a couple of obstacles with Ingress, but for this one, I couldn't come up with a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions