0

I need to restrict access to application based on ip address and need to block displaying page if it is opened other than chrome. Now i can able to restrict ip, But if i put the browser checking option, then instead of ip address checking, browser checking error document is displaying.

RewriteEngine on
RewriteMap hosts-allow "txt:D:\conf\apache\allowlist.txt" ErrorDocument 403 "This ip is not permitted" RewriteCond "${hosts-allow:%{REMOTE_ADDR}|NOT-FOUND}" "=NOT-FOUND" [OR] RewriteCond "${hosts-allow:%{REMOTE_HOST}|NOT-FOUND}" "=NOT-FOUND" RewriteRule .* - [F]

    ErrorDocument 403 "Only Chrome and Internet Explorer are supported by this application. Your browser is not supported." 
    RewriteCond %{HTTP_USER_AGENT} "Android|Macintosh|Linux|Mobile|OPR/|Firefox/"
    RewriteRule "^/?(.*)" - [F]

Can anyone care to provide some solution for this

  • The issue is solved by changing the rewrite rule, RewriteMap hosts-allow "txt:D:\conf\apache\allowlist.txt" ErrorDocument 405 "This ip is not permitted" RewriteCond "${hosts-allow:%{REMOTE_ADDR}|NOT-FOUND}" "=NOT-FOUND" [OR] RewriteCond "${hosts-allow:%{REMOTE_HOST}|NOT-FOUND}" "=NOT-FOUND" RewriteRule "^/?(.*)" - [L,R=405] – java_mechanic Oct 07 '22 at 03:34

0 Answers0