Method to protect IIS from hotlinking

5

There is some efficient method against hotlinking for IIS. I tried two but they did not work.

<!--Método 1-->
<rewrite>
    <rules>

        <rule name="Blacklist block" stopProcessing="true">
            <match url=".*" />
                <conditions>
                    <add input="{HTTP_REFERER}" pattern="^(?:https?:\/\/)?(?:www\.)?([^\/]+)(.+)?$" />
                    <add input="{DomainsBlackList:{C:1}}" pattern="^block$" />
                </conditions>
            <action type="AbortRequest" />
        </rule> >
    </rules>
    <rewriteMaps>
        <rewriteMap name="DomainsBlackList" defaultValue="allow">
            <add key="dominiobloqueado.com.br" value="block" />
            <add key="dominio2bloqueado.com.br" value="block" />    
        </rewriteMap>
    </rewriteMaps>
</rewrite>



<!--Método 2-->
<rewrite>
    <rules>

        <rule name="Prevenir Hotlink"> 
            <match url=".*" />
                <conditions>
                    <add input="{HTTP_REFERER}" pattern="^$" negate="true" />
                    <add input="{HTTP_REFERER}" pattern="http://meudominio.com/.*$" negate="true" />
                </conditions>
            <action type="Rewrite" url="/protecaohotlink.jpg" />
        </rule> 
    </rules>
</rewrite>
    
asked by anonymous 18.09.2015 / 18:24

0 answers