13 янв. 2016 г.

proxy.pac/wpad.dat для локальных адресов.

Чтобы в следующий раз не искаться, когда будет нужно, оставлю здесь взятый отсюда скрипт для proxy.pac/wpad.dat файла, благодаря которому браузеры, получившие автоматическую настройку прокси-сервера, будут по-прежнему напрямую ходить на локальные адреса:
function FindProxyForURL(url, host)
{
    // The 1st if function tests if the URI should be by-passed…
    // Proxy By-Pass List
    if (
        // ignore RFC 1918 internal addreses
        isInNet(host, "10.0.0.0", "255.0.0.0") ||
        isInNet(host, "172.16.0.0", "255.240.0.0") ||
        isInNet(host, "192.168.0.0", "255.255.0.0") ||

        // is url is like http://server by-pass
        isPlainHostName(host) ||

        // localhost!!
        localHostOrDomainIs(host, "127.0.0.1") ||

        // by-pass internal URLS
        dnsDomainIs(host, ".mycompany.com") ||
        dnsDomainIs(host, ".mycompany.local")
        )

        // If True, tell the browser to go direct…
        return "DIRECT";

        // If False, it’s not on the by-pass then Proxy the request… if you fail to connect to the proxy, try direct.

return "PROXY 10.10.10.10:8080;DIRECT";

}

Комментариев нет:

Отправить комментарий