アクセス制限と、リバースプロキシ

普通に、Directoryで禁止するだけだと、うまく禁止できない。Proxyを使用する。ちょっと、悩んだ。

<VirtualHost *:80>
    ServerName domain.com
    DocumentRoot /var/www/html
 
    <Directory />
        Deny from all
        Allow from 192.168
    </Directory>
    <Proxy *>        Deny from all
        Allow from 192.168
    </Proxy>
 
    # Reverse Proxy Reverse Proxy
    ProxyPassReverse / http://backend.domain/
    RewriteEngine On
 
    RewriteRule ^/image/ - [L]
    RewriteRule ^/css/ - [L]
    RewriteRule ^/js/ - [L]
    RewriteRule ^/(.*) http://backend.domain/$1 [P,L]
</VirtualHost>