Method to protect IIS from hotlinking

Asked

Viewed 76 times

5

There is some efficient method against hotlinking pro 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>
  • Take a look http://www.it-notebook.org/iis/article/prevent_hotlinking_url_rewrite.htm

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.