                     _ws_proxy_servers[t] = proxy
                 else
                     dbg("websocket upgrade -- using cache")
+                if internal_url?
+                    req.url = internal_url
                 proxy.ws(req, socket, head)
 
     public_raw_paths_cache = {}


        req_url = req.url.slice(base_url.length)  # strip base_url for purposes of determining project location/permissions
        dbg = (m) -> winston.debug("http_proxy_server websocket(#{req_url}): #{m}")
        target undefined, req_url, (err, location) ->
            if err
                dbg("websocket upgrade error -- #{err}")
            else

                    #    dbg("(mark: #{misc.walltime(tm)}) got response from the target")

                if internal_url?
                    req.url = internal_url
                proxy.web(req, res)

    winston.debug("starting proxy server listening on #{opts.host}:#{opts.port}")
