Verifying transparent HTTP payload compression at the reverse proxy layer is essential for minimising network bandwidth without taxing application backend processes. Windows Sandbox in Windows 11 provides a secure, self-contained Hyper-V container ideal for validating Traefik gzip and zstd compression middleware configurations prior to staging deployment.
Benefits of Traefik Compression Middleware
Traefik’s Compress middleware inspects client Accept-Encoding headers and dynamically applies gzip, deflate, or Brotli/zstd compression to responses meeting configured MIME-type criteria. Testing this inside a sandbox isolates performance benchmarking from the host system’s network adapter.
Authoring the Windows Sandbox WSB XML
Save the following XML document as TraefikCompressSandbox.wsb on your Windows 11 PC:
<Configuration>
<VGpu>Default</VGpu>
<Networking>Default</Networking>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\TraefikCompressLab</HostFolder>
<SandboxFolder>C:\TraefikCompressLab</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\TraefikCompressLab\setup-compress.ps1</Command>
</LogonCommand>
</Configuration>
PowerShell Deployment Script
Create the bootstrapping script at C:TraefikCompressLabsetup-compress.ps1:
Write-Host "Configuring Traefik Compression Sandbox..." -ForegroundColor Cyan
$Dir = "C:Traefik"
New-Item -ItemType Directory -Force -Path $Dir | Out-Null
$ZipUrl = "https://github.com/traefik/traefik/releases/download/v3.0.0/traefik_v3.0.0_windows_amd64.zip"
Invoke-WebRequest -Uri $ZipUrl -OutFile "$Dir raefik.zip"
Expand-Archive -Path "$Dir raefik.zip" -DestinationPath $Dir -Force
$Config = @"
http:
middlewares:
gzip-compress:
compress:
minResponseBodyBytes: 1024
encodings:
- "gzip"
- "deflate"
routers:
api-router:
rule: "PathPrefix(`/data`)"
middlewares:
- "gzip-compress"
service: "data-service"
services:
data-service:
loadBalancer:
servers:
- url: "http://127.0.0.1:8080"
"@
Set-Content -Path "$Dirdynamic_conf.yml" -Value $Config
Write-Host "Traefik Compress Middleware Configured Successfully." -ForegroundColor Green
Testing Compression Payloads
Launch the sandbox and execute requests using curl.exe -H "Accept-Encoding: gzip" -I http://127.0.0.1/data. Confirm the presence of Content-Encoding: gzip in the returned headers. When finished, closing the sandbox automatically wipes all files and system changes.