Giter Site home page Giter Site logo

proxy-wasm-hello-world's Introduction

Proxy Wasm Hello World

Proxy-Wasm enables developers to write Wasm proxy filters in their preferred language and deploy them to various dataplanes.

Benefits

  • Wasm enables powerful and performant extensibility of your datapath.
  • Sharing a common extension ecosystem across proxy implementations strengthens community growth.

What is WebAssembly?

First designed as an enhancement for modern web browsers, WebAssembly (Wasm) joined HTML, CSS, and JavaScript to be announced as the fourth W3C recommended "language for the Web". Wasm enabled Ahead of Time compiled (AOT) binaries to run in the browser unlocking new capabilities in the client rendered internet.

The Wasm System Interface (WASI) project extended Wasm beyond the browser by establishing the needed Application Binary Interface (ABI) standardization effort to formally build ecosystems of server side Wasm applications.

Wasm based proxy filter extensions depend on a proxy exposing an embedded Wasm runtime interface. First featured in the Envoy Proxy, Wasm for Proxies defines a standard integration spec to facilitate communication between the proxy host program and data filter extensions over the WASI ABI.

Get Started:

Dependencies:

  1. Make sure you have all dependencies

    Click to expand dependency check command
    bash -c "cat <<EOF | bash -es --
    git --version
    httpie --version
    docker --version
    EOF"
  1. Clone Wasm Filter repo for: proxy_wasm_hello_world

    git clone https://github.com/kong/proxy-wasm-hello-world wasm
  2. Run Kong API Gateway:

    curl -Ls https://get.konghq.com/quickstart | bash -s -- -i incubator -t gateway-wasmer-3.0.0.0 \
      -e "KONG_WASM=on" -e "KONG_WASM_MODULES=/wasm/proxy_wasm_hello_world.wasm" -v $(pwd)/wasm:/wasm
  3. Create a Mockbin.com demo Service:

    http POST :8001/services/ name="mockbin" host="mockbin.com" path="/bin/ccb2968e-08e8-43af-babd-878c9f269486" protocol="http"
  4. Create a Mockbin.com demo Route:

    http POST :8001/services/mockbin/routes name="mockbin" "paths[]=/mockbin"
  5. Configure Proxy Wasm filter proxy_wasm_hello_world on the mockbin route:

    http POST :8001/services/mockbin/plugins name="proxy-wasm" "config[filters][0][name]=proxy_wasm_hello_world"
  6. Check for header: Cowsay: Hello World

    http GET :8000/mockbin
    • Result:
    ❯ http GET :8000/mockbin
    HTTP/1.1 200 OK
    Connection: keep-alive
    Content-Length: 15
    Cowsay: Hello World
    Date: Wed, 21 Sep 2022 22:46:01 GMT
    Powered-By: proxy-wasm
    Server: nginx
    Via: kong/3.0.0.0-enterprise-edition
    X-Kong-Proxy-Latency: 340
    X-Kong-Upstream-Latency: 0
    
    Hello, World!

proxy-wasm-hello-world's People

Contributors

usrbinkat avatar casimiro avatar hishamhm avatar

Stargazers

Robin Cher avatar Yusheng Li avatar

Watchers

Guanlan D. avatar Colin Hutchinson avatar Yvonne Lam avatar Marco Palladino avatar Wanny Morellato avatar  avatar Felderi Santiago avatar  avatar

Forkers

hishamhm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.