Looks great in general, with a few queries and suggestions. https://codereview.appspot.com/102920048/diff/20001/environs/configstore/interface.go File environs/configstore/interface.go (right): https://codereview.appspot.com/102920048/diff/20001/environs/configstore/interface.go#newcode25 environs/configstore/interface.go:25: EnvironUUID string Why is this not an environ tag, to match the tag in api.Info ? https://codereview.appspot.com/102920048/diff/20001/state/api/apiclient.go File state/api/apiclient.go (right): https://codereview.appspot.com/102920048/diff/20001/state/api/apiclient.go#newcode151 state/api/apiclient.go:151: environUUID = envUUID why not just use environ tag throughout? https://codereview.appspot.com/102920048/diff/20001/state/api/export_test.go File state/api/export_test.go (right): https://codereview.appspot.com/102920048/diff/20001/state/api/export_test.go#newcode10 state/api/export_test.go:10: SetupWebsocket = setupWebsocket s/Setup/SetUp/ ? https://codereview.appspot.com/102920048/diff/20001/state/apiserver/apiserver.go File state/apiserver/apiserver.go (right): https://codereview.appspot.com/102920048/diff/20001/state/apiserver/apiserver.go#newcode184 state/apiserver/apiserver.go:184: handleAll(mux, "/:envuuid/log", One passing thought - we might be slightly more future proof and "obviously right" if the path was "/environ/$UUID/..." as we wouldn't need to rely on the fact that environ uuids can never conflict with any other path. If you do that, then bmizerany/pat becomes pretty much redundant, because it's almost as simple to just parse the first element of the URL path as a uuid. https://codereview.appspot.com/102920048/diff/20001/state/apiserver/apiserver.go#newcode195 state/apiserver/apiserver.go:195: // pat only does "text/plain" responses. That seems like a reason to avoid bmizerany/pat - if someone sends a method we don't understand, it would be nice to get a standard error back. handleAll isn't exhaustive. https://codereview.appspot.com/102920048/diff/20001/state/apiserver/apiserver.go#newcode210 state/apiserver/apiserver.go:210: handleAll(mux, "/", http.HandlerFunc(srv.apiHandler)) Can we please deprecate the behaviour that addressing any undefined url gives us the API? It was always unintentional, and now I believe it's actively harmful. It should be pretty simple to do - just write a handler that 404's any path that's not /, and register it to /. https://codereview.appspot.com/102920048/diff/20001/state/apiserver/apiserver.go#newcode249 state/apiserver/apiserver.go:249: // 2) On firt connect. The environment UUID is currently s/firt/first/ https://codereview.appspot.com/102920048/diff/20001/state/apiserver/apiserver.go#newcode256 state/apiserver/apiserver.go:256: env, err := srv.state.Environment() Rather than add an extra mongo round trip to every http request, we could store the UUID in the server. https://codereview.appspot.com/102920048/diff/20001/state/apiserver/common/errors.go File state/apiserver/common/errors.go (right): https://codereview.appspot.com/102920048/diff/20001/state/apiserver/common/errors.go#newcode50 state/apiserver/common/errors.go:50: ErrInvalidEnviron = stderrors.New("invalid environment requested") ErrUnknownEnviron = "unknown environment" ? https://codereview.appspot.com/102920048/diff/20001/state/apiserver/httphandler.go File state/apiserver/httphandler.go (right): https://codereview.appspot.com/102920048/diff/20001/state/apiserver/httphandler.go#newcode69 state/apiserver/httphandler.go:69: if envUUID != "" { if envUUID == "" { return nil } to save indentation? https://codereview.appspot.com/102920048/