backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

openlitespeed web server: "access denied" errors when saving forms or accessing admin pages #3584

Open klonos opened 5 years ago

klonos commented 5 years ago

Initially this began as an investigation on #3386. The problem seems to have been sorted with the 1.12.1 for all others that have reported the problem, but not for this installation (the difference being the LiteSpeed web server).

I do not have access to the server (doing this for @dyrer), but I have an admin account. PHP is 7.2.15 and db is 5.5.5-10.1.38-MariaDB.

I have tried to enable error logging for all errors in case this sheds some light, but when I tried to save the form in /admin/config/development/logging, I got "access denied" and got redirected to a page that had no admin bar. Hitting the "login" link got me back in without having to actually enter any credentials.

In general, when I visit certain admin pages like /admin/reports/status or /admin/reports/dblog, or individual errors like /admin/reports/event/475 I get "access denied". Refreshing the page gets me back in, and I can access the page I was trying to access.

Any ideas? I am thinking this might be session-related, because all those "access denied" errors are logged with Anonymous (not verified) as user.

dyrer commented 5 years ago

Actually is openlitespeed, is a little bit different from litespeed

klonos commented 5 years ago

...other thing is that LiteSpeed might not be handling redirects (AllowOverride All) same as apache/nginx.

klonos commented 5 years ago

@dyrer, can you please provide the version of openlitespeed used? It doesn't get picked up in /admin/reports/status:

Screen Shot 2019-03-14 at 5 15 07 am
klonos commented 5 years ago

@larsdesigns got any idea?

dyrer commented 5 years ago

image and https://www.litespeedtech.com/products/litespeed-web-server/editions

klonos commented 5 years ago

OK, doing some research revealed that openlitspeed does not support .htaccess: https://forum.openlitespeed.org/threads/mod_rewrite-siberiancms.2654/

openlitespeed doesn't support .htaccess, you can simple copy the rewrites rules ( rewrite rules only, nothing else ) to the virtual host rewrite section in OpenLiteSpeed Admin Console.

klonos commented 5 years ago

Related: https://www.drupal.org/project/drupal/issues/1176508

I have posted the requirement on Litespeed Forum http://www.litespeedtech.com/support/forum/showthread.php?p=27083 ... by default, mod_rewrite is enabled.

if you're using native configured virtual host instead of reading apache's httpd.conf, need set Allow Override: lsws admin console(:7080) -> Configure -> Server -> General -> Allow Override: uncheck "None", check all others

similar settings at vhost level: Virtual Hosts -> General -> Allow Override

klonos commented 5 years ago

https://serverfault.com/questions/538249/does-openlitespeed-support-apache-rewrites

.htaccess files are not supported, but you can copy the rewrite rules from the .htaccess and paste into OpenLiteSpeed admin console

@dyrer can you please copy-paste these in the OpenLiteSpeed admin console:

RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_URI} !^/\.well-known
RewriteRule "(^|/)\." - [F]

RewriteCond %{REQUEST_URI} ^(.*)?/(update.php) [OR]
RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
RewriteCond %{REQUEST_URI} ^(.*)?/(cron.php)
RewriteCond %{REQUEST_URI} !core
RewriteRule ^ %1/core/%2 [L,QSA,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Our .htaccess has some more rewrite rules, but these are inside a <IfModule mod_headers.c>, so not sure if openlitespeed supports that: https://github.com/backdrop/backdrop/blob/1.x/.htaccess

klonos commented 5 years ago

Actually, these KB articles might also help:

Enabling Drupal cache on OpenLiteSpeed: https://openlitespeed.org/kb/litespeed-cache-for-drupal-on-openlitespeed

Quick Install Drupal 8 on OpenLiteSpeed: https://openlitespeed.org/kb/drupal8/

larsdesigns commented 5 years ago

I do not have experience with litespeed web server. I recommend setting up a litespeed intance on your workstation using docker so you have full access and then working out the configuration from there.

yorkshire-pudding commented 2 years ago

As mentioned on #5525 I'm checking this. I have not experienced this on my LiteSpeed hosting so I guess it is (or was) limited to OpenLiteSpeed. A quick search shows a number of discussions after this one on various sites which suggests that OpenLiteSpeed may now support some aspects of .htaccess. I'm not clued up enough about docker to test this and Lando doesn't have the option.

larsdesigns commented 2 years ago

This looks like useful documentation for getting started with Lightspeed with Docker: https://docs.litespeedtech.com/cloud/docker/