Wasm Labs

mod_wasm

Apache httpd module to run WebAssembly modules

Get started

Description

A new Apache httpd module to configure and run WebAssembly modules. It allows you to run any language in Apache by compiling it to WebAssembly

Repository

GitHub

License

Apache License 2.0

Languages

About the project

mod_wasm is an Apache Server (httpd) module to run WebAssembly modules and reply to HTTP requests with them. Currently, Apache Server runs the 31% of all websites you access every day.

By bringing WebAssembly to its ecosystem, you will be able to:

  • Run existing applications from many different languages without modifying them
  • Run unstrusted third-party code in a sandboxed and secure environment
  • A security based capability-model that ensures applications only have access to the resources you configured

Internally, mod_wasm is composed by two different libraries:

  • mod_wasm.so: the extension module for Apache Server
  • libwasm_runtime.so: a high-level C-API to manage WebAssembly modules via Wasmtime

Try it

We created a container that includes Apache Server, mod_wasm and a few examples:

  1. Run the container:

    docker run -p 8080:8080 ghcr.io/vmware-labs/httpd-mod-wasm:latest
  2. Now, open your browser at:

Demo Wasm Module URL
Drupal PHP 8.2.0 http://localhost:8080/drupal
Drupal (from setup) PHP 8.2.0 http://localhost:8080/drupal-10-zero
WordPress PHP 7.3.33 http://localhost:8080/wordpress
HTTP Request Viewer Python 3.11 http://localhost:8080/http-request-viewer

We also prepared more examples you can play with.

Learn more

To continue learning about mod_wasm, we recommend you to check the following links:

Do you want to stay up to date with WebAssembly and our projects?