<!--
	Other Yandex rulests:

		- Loginza.ru.xml


    For any questions please contact Artyom Gavrichenkov <ximaera@yandex.ru>.

    I'm not in any way a Yandex employee, however, this set of rules is
    already working for a long time with all Yandex services, being used very
    intensively, and thus is being shared with community in order to prevent
    scam and stealing from Money.Yandex.ru (and other services as well).

    If you want to know about license terms, here they are:

    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    Version 2, December 2004

    Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

    Everyone is permitted to copy and distribute verbatim or modified
    copies of this license document, and changing it is allowed as long
    as the name is changed.

    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    0. You just DO WHAT THE FUCK YOU WANT TO.


    Nonfunctional domains:

        - clubs.ya.ru       (redirects to http)

		- yandex.ru subdomains:

			- advertising	(dropped)


	Problematic domains:

		- www.yandex.ru		(dropped)


	Partially covered domains:

		- www.yandex.ru		(→ ^)


	Fully covered domains:

		- awaps.yandex.by
		- awaps.yandex.com.au
		- awaps.yandex.kz
		- favicon.yandex.net
		- awaps.yandex.ru
		- awaps.yandex.ua
		- awaps.yandex.ru

-->
<ruleset name="Yandex">

    <target host="moikrug.ru" />
    <target host="*.moikrug.ru" />
    <target host="ya.ru" />
    <target host="*.ya.ru" />
	<target host="awaps.yandex.*" />
    <target host="yandex.net" />
    <target host="*.yandex.net" />
    <target host="yandex.ru" />
    <target host="*.yandex.ru" />


	<!--securecookie host="^\.yandex\.ru$" name="^yandexuid$" /-->
    <securecookie host="(?:mc|\.video)\.yandex\.ru$" name=".*" />


    <!--
        Rather than enumerating domains that support SSL,
        we enable SSL for all services and then exclude those
        which become broken:


        1. Public services without HTTPS support (or with broken support)
                                        -->
    <exclusion pattern="^http://(?:bar-widgets|blogs|cards|cs-ellpic|cs-thumb|dict|dzen|encyclopedia|feedback|fotki|images|lingvo|ll|metro|mirror|music|newmoscow|news|openid|pogoda|presocial|rasp|slovari|sprav|static-maps|tv|wdgt|weather|wordstat|xml)\.yandex\.ru/" />
		<exclusion pattern="^http://www\.yandex\.ru/(?!cycounter(?:$|\?))" />

    <!--
            Needed for Yandex video player to work. 
                                                                                -->

    <exclusion pattern="^http://video\.yandex\.ru/iframe/" />
    <exclusion pattern="^http://[^.]+\.video\.yandex\.net/" />
    <exclusion pattern="^http://streaming\.video\.yandex\.ru/" />
    <exclusion pattern="^http://[^.]+\.video\.yandex\.ru/q-upload/" />
    <!--
        Remove this if you do never post entries or comments on my.ya.ru
                                        -->
    <exclusion pattern="^http://(?:www\.)?[^.]+\.ya\.ru/" />

    <!--    2. Simple redirections
                    -->
    <exclusion pattern="^http://probki\.yandex\.ru/" />
    <exclusion pattern="^http://(?:blogs|fotki|images|music|probki|video|wdgt|www)\.ya\.ru" />

    <!--    3. Narod.ru.

        Narod.ru doesn't use auth data from Yandex,
        so we don't need to encrypt its pages.
        The only exception is Narod.Disk, but it doesn't provide HTTPS
                                        -->
    <exclusion pattern="^http://narod\d*\.yandex\.ru/" />

    <!--    4. Search suggestions
                    -->
    <exclusion pattern="^http://suggest\.yandex\.ru/" />
    <exclusion pattern="^http://suggest-[a-z]+\.yandex\.(?:net|ru)/" />

    <!--    5. Webmaster
                -->
    <exclusion pattern="^http://content\.webmaster\.yandex\.ru/" />

    <!--    6. Mobile services
                    -->
    <exclusion pattern="^http://(?:m|mobile)\.yandex\.ru/" />

    <!--    7. Internet.Yandex.Ru (connection rate detection breaks with HTTPS)
                                            -->
    <exclusion pattern="^http://internet\.yandex\.ru/" />

    <!--    8. Various click counters and content storages.
                                -->
    <exclusion pattern="^http://(?:clck|copy|hghltd|kiks|print|market-click\d+|wrz)\.yandex\.ru/" />
    <exclusion pattern="^http://mdata\.yandex\.(?:ru|net)/" />

    <!--    9. Data clusters for Maps and Video
                            -->
    <exclusion pattern="^http://(?:jgo|vec\d+)\.maps\.yandex\.(?:net|ru)/" />
    <exclusion pattern="^http://[^.]+-tub(?:-[^.]+)?\.yandex\.(?:net|ru)/" />

    <!--    10. More subdomains without SSL from Aleksey Kosterin.
                                    -->
    <exclusion pattern="^http://(?:advertising|afisha|api|browser|business|collection|fx|help|kapersky|keyboard|large|market|nahodki|navigator|online|opera|punto|site|skype|time|yaca|zakladki)\.yandex\.ru/" />

    <!--    11. Some cert warnings.
                    -->
    <exclusion pattern="^http://(?:ie|soft|widgets)\.yandex\.ru/" />

    <!--    12. Drop down menu UI bugs -->

    <exclusion pattern="^http://tune\.yandex\.ru/" />



    <!--    Rewriting rules.
                -->
	<rule from="^http://www\.yandex\.ru/cycounter(?=$|\?)"
		to="https://yandex.ru/cycounter" />

    <rule from="^http://(?:www\.)?([^.]+)\.yandex\.(net|ru|st)/"
        to="https://$1.yandex.$2/" />

    <rule from="^http://(?:www\.)?yandex\.(net|st)/"
        to="https://yandex.$1/" />

    <!--    Redirects to www for pages.
            In particular, this catches counters.
                                -->
    <rule from="^http://yandex\.ru/"
        to="https://yandex.ru/" />

    <!--
        Here we can enable 4+ level domains with a single regexp,
        but I've never seen any domains more that 4 levels deep
        in Yandex network, so I wouldn't enable them now -
        it may be unconvenient and may broke some services.
        Only 4-level domains match.
                        -->
    <rule from="^http://([^.]+)\.([^.]+)\.yandex\.(net|ru)/"
        to="https://$1.$2.yandex.$3/" />

    <rule from="^http://(?:www\.)?([^.]+)\.ya\.ru/"
        to="https://$1.ya.ru/" />

    <rule from="^http://(?:www\.)?moikrug\.ru/"
        to="https://moikrug.ru/" />

	<rule from="^http://awaps\.yandex\.(com\.au|by|kz|ua)/"
		to="https://awaps.yandex.$1/" />


    <!--    timeout
        Example:    https://market.yandex.ru/search.xml?text=draytek&hid=91083&srnum=233
        List:       https://mail1.eff.org/pipermail/https-everywhere-rules/2012-April/001094.html
                                -->
    <rule from="^https://(cs-ellpic|mdata)\.yandex\.net/"
        to="http://$1.yandex.net/" downgrade="1" />

    <!--    "<error><status>401</status><message>Unauthorized</message><cause>Incorrect referer</cause></error>"
        https doesn't give a referrer, so images don't load.
        Example:    https://market.yandex.ru/search.xml?text=draytek&hid=91083&srnum=233
        List:       https://mail1.eff.org/pipermail/https-everywhere-rules/2012-April/001094.html
                                -->
    <rule from="^https://static-maps\.yandex\.ru/"
        to="http://static-maps.yandex.ru/" downgrade="1" />

</ruleset>

