Deploying Rust and WebAssembly to Production
⚡ Deploying Web applications built with Rust and WebAssembly is nearly identical to deploying any other Web application!
To deploy a Web application that uses Rust-generated WebAssembly on the client, copy the built Web application's files to your production server's file system and configure your HTTP server to make them accessible.
Ensure that Your HTTP Server Uses the
application/wasm MIME Type
For the fastest page loads, you'll want to use the
WebAssembly.instantiateStreaming function to pipeline
wasm compilation and instantiation with network transfer (or make sure your
bundler is able to use that function). However,
that the HTTP response has the
application/wasm MIME type set, or else it
will throw an error.
- How to configure MIME types for the Apache HTTP server
- How to configure MIME types for the NGINX HTTP server
- Apache documentation. Apache is a popular HTTP server for use in production.
- NGINX documentation. NGINX is a popular HTTP server for use in production.