← 返回
未分类 中文

Boxed HTTP Server

WebAssembly sandbox static HTTP server with HTTP Basic auth and proxy support. Use when starting a static file server, configuring HTTP authentication, setti...
WebAssembly 沙箱静态 HTTP 服务器,支持 HTTP 基本认证和代理。用于启动静态文件服务器、配置 HTTP 认证、设置...
guyoung
未分类 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 393
下载
💾 0
安装
1
版本
#latest

概述

boxed-http-server

A lightweight static HTTP server based on WebAssembly sandbox, with support for HTTP Basic authentication and HTTP proxy/reverse proxy.

Trigger When

Use this skill when the user describes (触发场景):

  • Starting a static file server (启动静态文件服务器)
  • Configuring HTTP Basic authentication (配置 HTTP 认证)
  • Setting up HTTP proxy or reverse proxy (设置 HTTP 代理或反向代理)
  • Running a local development server (搭建本地开发服务器)
  • Deploying a static website (部署静态网站)
  • Adding authentication to a static site (为静态网站添加认证保护)

Prerequisites

  • openclaw-wasm-sandbox plugin: Must be installed and enabled, version >=0.4.0
  • wasm file download: Download required before first use

Download wasm File

wasm-sandbox-download({
  url: "https://raw.githubusercontent.com/guyoung/wasm-sandbox-openclaw-skills/main/boxed-http-server/files/boxed_http_server_component.wasm",
  dest: "~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm"
})

Or via command line:

curl -L -o ~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm \
  "https://raw.githubusercontent.com/guyoung/wasm-sandbox-openclaw-skills/main/boxed-http-server/files/boxed_http_server_component.wasm"

Start Static File Server

wasm-sandbox-serve({
  wasmFile: "~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm",
  workDir: ["~/.openclaw/skills/boxed-http-server/files"]
})

Or via command line:

openclaw wasm-sandbox serve ~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm \
  -i 192.168.1.100 -p 8080 --work-dir /path/to/website

HTTP Basic Authentication

Protect your website with username/password authentication:

wasm-sandbox-serve({
  wasmFile: "~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm",
  workDir: ["~/.openclaw/skills/boxed-http-server/files"],
  args: ["--config-var", "username=admin", "--config-var", "password=admin"]
})

HTTP Proxy / Reverse Proxy

Proxy external APIs through the server. Requires allowedOutboundHosts for the target domain:

wasm-sandbox-serve({
  wasmFile: "~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm",
  workDir: ["~/.openclaw/skills/boxed-http-server/files"],
  allowedOutboundHosts: ["https://httpbin.org"],
  args: ["--config-var", "proxy=\"[{\\\"path\\\": \\\"/httpbin\\\",\\\"target\\\" :\\\"https://httpbin.org\\\",\\\"headers\\\": {\\\"Authorization\\\": \\\"Bearer abcd1234\\\"}}]\""]
})

Combined Example: Static Site + API Proxy

Serve a static website while proxying external APIs to avoid CORS issues:

wasm-sandbox-serve({
  wasmFile: "~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm",
  workDir: ["/home/user/website"],
  allowedOutboundHosts: ["https://api.weather.com", "https://wttr.in"],
  args: ["--config-var", "proxy=\"[{\\\"path\\\": \\\"/weather\\\",\\\"target\\\": \\\"https://wttr.in\\\"}]\""]
})

Then update your frontend to call /weather instead of the external API directly.

Parameters

ParameterTypeRequiredDescription
----------------------------------------
wasmFilestringYesPath to the wasm component file
workDirstring[]YesWebsite root directories (served as static files)
allowedOutboundHostsstring[]NoAllowed external domains for proxy mode
argsstring[]NoCommand-line args for auth and proxy config

CLI Options (for openclaw wasm-sandbox serve)

OptionShortDescription
----------------------------
--ip -iSocket IP to bind to
--port -pSocket port to bind to (0-65535)
--work-dir Website root directory
--config-var WASI config variables
--allowed-outbound-hosts Allowed external domains (proxy mode)

Available args Config

  • --config-var username= - Set Basic auth username
  • --config-var password= - Set Basic auth password
  • --config-var proxy= - Set proxy rules in JSON format

proxy Config Format

[
  {
    "path": "/httpbin",
    "target": "https://httpbin.org",
    "headers": {
      "Authorization": "Bearer abcd1234"
    }
  }
]
FieldTypeDescription
--------------------------
pathstringProxy path prefix (requests matching this prefix will be proxied)
targetstringTarget full URL
headersobjectOptional custom headers to add to the proxied request

Security Model

Boxed HTTP Server runs inside WebAssembly sandbox with capability-based security:

  • No implicit access: WASM module has zero access by default
  • Explicit grants only: Access must be explicitly allowed via configuration
  • Network isolation: Outbound network access is denied by default
  • Resource limits: Supports timeout, memory, stack size, and fuel limits

Architecture

User Request
    ↓
OpenClaw Gateway
    ↓
Wasm Sandbox Plugin
    ↓
boxed_http_server_component.wasm
    ↓
├── Static File Handler (workDir)
├── Basic Auth Handler (args: username/password)
└── Proxy Handler (args: proxy config)
    ↓
Response to Client

Example: Full Deployment

Deploy a static website at http://192.168.158.134:8080:

# 1. Download wasm file (if not exists)
curl -L -o ~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm \
  "https://raw.githubusercontent.com/guyoung/wasm-sandbox-openclaw-skills/main/boxed-http-server/files/boxed_http_server_component.wasm"

# 2. Start server
openclaw wasm-sandbox serve \
  ~/.openclaw/skills/boxed-http-server/files/boxed_http_server_component.wasm \
  -i 192.168.158.134 \
  -p 8080 \
  --work-dir /home/user/website

Troubleshooting

IssueSolution
-----------------
"wasm file not found"Run the download step first
"Connection refused"Check IP and port, ensure firewall allows access
"CORS errors in frontend"Use proxy mode to route external APIs through the server
"Authentication not working"Ensure username and password are set in args
"Proxy returns 403"Add target domain to allowedOutboundHosts

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 06:01 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Graphviz

guyoung
使用 WebAssembly 将 Graphviz DOT 图生成 SVG 图像,依赖 openclaw-wasm-sandbox 插件中的 graphviz_component.wasm,无需安装 Graphviz 系统。
★ 0 📥 375

Boxed fs

guyoung
WebAssembly 沙箱文件系统操作,用于在明确声明的目录中进行安全的文件读取、写入、追加、复制等。
★ 0 📥 370

OpenCV

guyoung
使用 OpenCV WebAssembly 实现计算机视觉和图像处理。通过 openclaw-wasm-sandbox 插件加载 opencv-component.wasm 运行,支持图像处理等功能。
★ 0 📥 518