Henry Aspden
Henry Aspden

Reputation: 1945

Litespeed Enterprise not obeying .htaccess require rules

I have the following folder structure

domain.com (/public_html/)
sub.domain.com (/public_html/sub/)
sub.domain.com/dir1/ (/public_html/sub/dir1/)
sub.domain.com/dir1/dir2/ (/public_html/sub/dir1/dir2/)

if I put the following in my .htaccess file at any of these directories

DirectoryIndex index.php

require valid-user
<RequireAny>
    Require ip x.x.x.x
</RequireAny>

It has no effect when loading any files in these directories.

Additionally if i want multiple require rules to have and/or then it gets a little more complicated for example

# Allowing Access via Password or one of the following IP Addresses

AuthName "Authorized Only"
AuthType Basic
AuthUserFile /home/.htpasswds/.htpasswd

<RequireAll>
require valid-user
<RequireAny>
    Require ip x.x.x.x
    Require ip y.y.y.y
</RequireAny>
</RequireAll>

Apache did follow these rules set, but switching to litespeed enterprise web server has meant that IP restrictions have been ignored

What am I missing here?

Upvotes: 1

Views: 704

Answers (1)

MrWhite
MrWhite

Reputation: 45914

require valid-user
<RequireAny>
    Require ip x.x.x.x
</RequireAny>

This would seem to be overkill for Apache 2.4. <RequireAny> is the default container. The above 4 lines is the same as the one-line Require ip x.x.x.x.

However, my experience with LiteSpeed is that it behaves more like an Apache 2.2 server and (annoyingly) silently fails on directives it does not understand (although there might be something logged in the server's error log).

Try the following (Apache 2.2 style) directives instead:

Order Allow,Deny
Allow from x.x.x.x

Upvotes: 2

Related Questions