Sunday, April 3, 2022

[SOLVED] Attempt to refuse all connections except one domain

Issue

I've been trying for some hours block all connection except my domain in httpd config. but I'm not able to connect with my own domain. I just get Forbidden page.

<VirtualHost *:80>
ServerName Server-VM
DocumentRoot /var/www/
    SetEnvIf Referer domain\.cc internal
    <FilesMatch "\.(avi|mp4)$">
    Order Deny,Allow
    Deny from all
    Allow from env=internal
   </FilesMatch>
</VirtualHost>

My Apache version: 2.2.15 What am I doing wrong?

Thank you!


Solution

The Allow, Deny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use.

Try

<FilesMatch "\.(avi|mp4)$">
   Require host domain.cc
</FilesMatch>

More info from https://httpd.apache.org/docs/2.4/howto/access.html



Answered By - Antti A
Answer Checked By - Marie Seifert (WPSolving Admin)