diff --git a/spread.yaml b/spread.yaml
index 5138ad913a1ddd3c30e44221b17d27c6d5363c71..cf0a7d85b6cacac92c90d5684e0a2b033c3f239a 100644
--- a/spread.yaml
+++ b/spread.yaml
@@ -28,8 +28,15 @@ environment:
     # Use non-volatile tmp as the tests may REBOOT.
     TEST_RAUC_KEYS_DIR: /var/tmp/rauc-keys
     TEST_RAUC_FAKE_SYSTEM_DIR: /var/tmp/rauc-fake-system
+    HOST_APT_PROXY: "$(HOST: /usr/share/squid-deb-proxy-client/apt-avahi-discover 2>/dev/null)"
 
 prepare: |
+    set -x
+    if [ -n "$HOST_APT_PROXY" ]; then
+        printf 'Acquire::http::Proxy "%s";\n' "$HOST_APT_PROXY" >/etc/apt/apt.conf.d/00spread-apt-proxy.conf
+    fi
+
+
     # Install build dependencies if missing.
     test -n "$(command -v go)" && test -f /usr/include/z.mk && test -f /lib/systemd/system/rauc.service && test -n "$(command -v mksquashfs)" && test -n "$(command -v jq)" && test -n "$(command -v mandb)" && test -n "$(command -v strace)" || (
         apt-get update && apt-get install -y golang-go zmk rauc-service squashfs-tools jq man-db strace