code: func NewServer(filebase string, apiProxyPrefix string, staticPrefix string, filter *FilterServer, cfg *rest.Config, keepalive time.Duration) (*Server, error) {
  	host := cfg.Host
  	if !strings.HasSuffix(host, "/") {
  		host = host + "/"
  	}
  	target, err := url.Parse(host)
  	if err != nil {
  		return nil, err
  	}
  
  	responder := &responder{}
  	transport, err := rest.TransportFor(cfg)
  	if err != nil {
  		return nil, err
  	}
  	upgradeTransport, err := makeUpgradeTransport(cfg, keepalive)
  	if err != nil {
  		return nil, err
  	}
  	proxy := proxy.NewUpgradeAwareHandler(target, transport, false, false, responder)
  	proxy.UpgradeTransport = upgradeTransport
  	proxy.UseRequestLocation = true
  
  	proxyServer := http.Handler(proxy)
  	if filter != nil {
  		proxyServer = filter.HandlerFor(proxyServer)
  	}
  
  	if !strings.HasPrefix(apiProxyPrefix, "/api") {
  		proxyServer = stripLeaveSlash(apiProxyPrefix, proxyServer)
  	}
  
  	mux := http.NewServeMux()
  	mux.Handle(apiProxyPrefix, proxyServer)
  	if filebase != "" {
  		// Require user to explicitly request this behavior rather than
  		// serving their working directory by default.
  		mux.Handle(staticPrefix, newFileHandler(staticPrefix, filebase))
  	}
  	return &Server{handler: mux}, nil
  }
docs: // NewServer creates and installs a new Server.
  // 'filter', if non-nil, protects requests to the api only.