packages/browser-sync/lib/server/proxy-utils.js
function rewriteCookies(rawCookie) {
    var objCookie = (function() {
        // simple parse function (does not remove quotes)
        var obj = {};
        var pairs = rawCookie.split(/; */);

        pairs.forEach(function(pair) {
            var eqIndex = pair.indexOf("=");

            // skip things that don't look like key=value
            if (eqIndex < 0) {
                return;
            }

            var key = pair.substr(0, eqIndex).trim();
            obj[key] = pair.substr(eqIndex + 1, pair.length).trim();
        });

        return obj;
    })();

    var pairs = Object.keys(objCookie)
        .filter(function(item) {
            return item.toLowerCase() !== "domain";
        })
        .map(function(key) {
            return key + "=" + objCookie[key];
        });

    if (rawCookie.match(/httponly/i)) {
        pairs.push("HttpOnly");
    }

    return pairs.join("; ");
}
function rewriteCookies(rawCookie) {
    var objCookie = (function() {
        // simple parse function (does not remove quotes)
        var obj = {};
        var pairs = rawCookie.split(/; */);

        pairs.forEach(function(pair) {
            var eqIndex = pair.indexOf("=");

            // skip things that don't look like key=value
            if (eqIndex < 0) {
                return;
            }

            var key = pair.substr(0, eqIndex).trim();
            obj[key] = pair.substr(eqIndex + 1, pair.length).trim();
        });

        return obj;
    })();

    var pairs = Object.keys(objCookie)
        .filter(function(item) {
            return item.toLowerCase() !== "domain";
        })
        .map(function(key) {
            return key + "=" + objCookie[key];
        });

    if (rawCookie.match(/httponly/i)) {
        pairs.push("HttpOnly");
    }

    return pairs.join("; ");
}
function rewriteCookies ( rawCookie ) { var objCookie = ( function ( ) { // simple parse function (does not remove quotes) var obj = { } ; var pairs = rawCookie . split ( / ; * / ) ; pairs . forEach ( function ( pair ) { var eqIndex = pair . indexOf ( "=" ) ; // skip things that don't look like key=value if ( eqIndex < 0 ) { return ; } var key = pair . substr ( 0 , eqIndex ) . trim ( ) ; obj [ key ] = pair . substr ( eqIndex + 1 , pair . length ) . trim ( ) ; } ) ; return obj ; } ) ( ) ; var pairs = Object . keys ( objCookie ) . filter ( function ( item ) { return item . toLowerCase ( ) !== "domain" ; } ) . map ( function ( key ) { return key + "=" + objCookie [ key ] ; } ) ; if ( rawCookie . match ( / httponly / i ) ) { pairs . push ( "HttpOnly" ) ; } return pairs . join ( "; " ) ; }
Remove the domain from any cookies.
@param rawCookie
@returns {string}
Remove the domain from any cookies .