Modern microservice and cloud-native API architectures frequently deploy Apache APISIX as a dynamic, high-performance API gateway. Built on top of Nginx and LuaJIT, Apache APISIX provides dynamic routing, hot plugin reloading, traffic splitting, rate limiting, and open-source observability without requiring gateway restarts. When developing APISIX route configurations or testing custom Lua plugins, running gateway processes on a host development machine can leave lingering background daemons or conflict with local networking ports. Windows Sandbox in Windows 11 Pro and Enterprise provides an ephemeral, hardware-isolated guest instance ideal for disposable API gateway testing.
By pairing automated Windows Sandbox configuration files (.wsb) with PowerShell setup scripts, developers can spin up an ephemeral Apache APISIX testing sandbox with a single double-click, validate routing rules thoroughly, and discard the environment cleanly upon exit.
Windows Sandbox Architecture and Setup Primitives
Windows Sandbox provides a pristine, virtualized Windows 11 environment powered by Microsoft’s Hyper-V hypervisor. A .wsb XML file configures container parameters:
<Networking>: Must be set toEnableto download the portable APISIX standalone binary distribution.<MappedFolders>: Maps a host directory into the container to supply bootstrap scripts, standaloneapisix.yamlfiles, and test payloads.<LogonCommand>: Automatically executes PowerShell setup scripts when the sandbox desktop loads.
Creating the APISIX Automated Setup Script
Create a directory on your host machine (e.g., C:\Sandbox\APISIX) and save the following script as bootstrap-apisix.ps1:
# bootstrap-apisix.ps1 - Automated Apache APISIX Setup for Windows Sandbox
$ErrorActionPreference = "Stop"
Write-Host "Configuring Apache APISIX Sandbox Environment..." -ForegroundColor Cyan
# Install APISIX binary distribution via winget or official release
Write-Host "Installing Apache APISIX Gateway..." -ForegroundColor Yellow
winget install Apache.APISIX --silent --accept-package-agreements --accept-source-agreements
# Refresh environment variables
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
# Define APISIX working directory
$apisixDir = "C:\APISIXApp"
New-Item -ItemType Directory -Path "$apisixDir\conf" -Force
Set-Location $apisixDir
# Author standalone configuration (conf/apisix.yaml)
$apisixYaml = @"
routes:
- id: 1
uri: /api/*
upstream:
nodes:
"httpbin.org:443": 1
type: roundrobin
scheme: https
plugins:
limit-count:
count: 10
time_window: 60
rejected_code: 429
#END
"@
$apisixYaml | Out-File -FilePath "$apisixDir\conf\apisix.yaml" -Encoding utf8
# Author core config.yaml for standalone mode
$configYaml = @"
deployment:
role: data_plane
role_data_plane:
config_provider: yaml
apisix:
node_listen: 8080
"@
$configYaml | Out-File -FilePath "$apisixDir\conf\config.yaml" -Encoding utf8
# Start APISIX gateway in background
Write-Host "Starting Apache APISIX on port 8080..." -ForegroundColor Green
Start-Process "apisix" -ArgumentList "start -p C:/APISIXApp" -WorkingDirectory $apisixDir
# Open Edge to test endpoint
Start-Sleep -Seconds 4
Start-Process "msedge.exe" -ArgumentList "http://localhost:8080/api/get"
Authoring the Windows Sandbox WSB File
In the same folder, author the configuration file named APISIXSandbox.wsb:
<Configuration>
<VGpu>Enable</VGpu>
<Networking>Enable</Networking>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\Sandbox\APISIX</HostFolder>
<SandboxFolder>C:\APISIXSetup</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\APISIXSetup\bootstrap-apisix.ps1</Command>
</LogonCommand>
</Configuration>
Running and Testing APISIX Inside the Sandbox
- Double-click
APISIXSandbox.wsbon your Windows 11 host. - Windows Sandbox initializes, maps the configuration folder, and executes the PowerShell setup script.
- Apache APISIX is installed silently, configured in standalone YAML mode, and started on port 8080.
- Microsoft Edge launches automatically displaying the proxied response with rate-limiting headers.
- When finished, close the Sandbox window; all temporary gateway configurations and logs are instantly purged.
This automated workflow provides an efficient, clean environment for testing Apache APISIX Gateway configurations on Windows 11 without impacting your host development system.