bitly/google_auth_proxy — pull request #14 by airhorns (2014-03-27 21:00:11+00:00)
Title: Add ability to proxy websocket connections as well as normal HTTP requests

@justinplouffe would you mind giving this a review, and maybe pulling in another stack member?

This adds websocket proxying abilities to the reverse proxy while maintaining all other functionality. We ran into this trying to use the auth proxy in front of ipython notebooks.

- Adds a `httputil.SingleHostReverseProxy` wrapper which checks the incoming connection for upgrade headers
- Uses `http` hijacking to take control of the connection if it is for websockets
- Spawns goroutines to spit data received on the proxy out to the connection to the upstream and vice versa
- Passes normal http connection to the normal single host reverse proxy
- Keeps the path based upstream mapping in tact using the `serveMux`