Wed, 17 Oct 2012

Wazproxy: an HTTP Proxy That Signs Windows Azure Storage Requests

Last night, I published Wazproxy, an HTTP proxy written in Node.js that automatically signs requests to Windows Azure blob storage for a given account. This is useful for developers who want to try out the Windows Azure REST API without having to deal with authentication. By running wazproxy and proxying web requests through it, you can use simple tools like curl or even a web browser to interact with Windows Azure storage.

Wazproxy is also useful for adapting existing apps to work with Windows Azure storage. For example, if you have an application that can consume a generic OData feed but doesn't support Windows Azure storage authentication, you can start wazproxy, change your proxy settings, and use the application as-is.

To install, just run npm install wazproxy -g. Then run wazproxy -h to see the usage:

Usage: wazproxy.js [options]

  Options:

    -h, --help               output usage information
    -V, --version            output the version number
    -a, --account [account]  storage account name
    -k, --key [key]          storage account key
    -p, --port [port]        port (defaults to 8080)

There are more examples on the Wazproxy GitHub page, but here's how you can manipulate blob storage using curl. This example creates a container, uploads a blob, retrieves that blob, and then deletes the container:

curl <account>.blob.core.windows.net/testcontainer?restype=container -X PUT -d ""

curl <account>.blob.core.windows.net/testcontainer/testblob -X PUT -d "hello world" -H "content-type:text/plain" -H "x-ms-blob-type:BlockBlob"

curl <account>.blob.core.windows.net/testcontainer/testblob
# output: "hello world"

curl <account>.blob.core.windows.net/testcontainer?restype=container -X DELETE

Get the code

The full source code is available on GitHub, under an MIT license: https://github.com/smarx/wazproxy