Hi Guys,
I believe I have found an error/bug on Litespeed Web Server Open 1.4.13.
This is very easy to duplicate and can be done a couple of ways but first let me try and explain what I am trying to achive.
What I would like to do is add a few extra headers as well as adding expire times when your accessing php files. To be exact I am trying to add the following..
Expire by Type
application/x-httpd-php=A0, application/x-httpd-php-source=A0, application/x-httpd-php3=A0, application/x-httpd-php3-preprocessed=A0, application/x-httpd-php4=A0, application/x-httpd-php5=A0
Extra Headers
Cache-Control: "no-store, no-cache, must-revalidate, max-age=0"
Pragma: "no-cache"
Now if you add the Expire by Types on the vhost level general page and then try and curl -i URL, you will find that its actully using the default/server level PHP and if your using SuEXEC by Daemon (like I am), it knocks it off (uses default user of web server) even tho its also set on server level as well to use SuEXEC. You can see below...
Do note that this Cache-Control flag is being pulled atm from the contex of / but was in the middle of changing to use regex solution so I can have a differernet header based of file types. However with this on or off, makes no difference due to this bug.
The reason why I noticed this error was because I still have the X-Powered-By flag still turned on the default/server level and is runnning PHP7 vrs my usual vhost level PHP 5.1.16 else I may of not noticed for a while.
You can also confirm that the user is wrong by using some simple PHP code..
If you curl that url you will get..
Which is very wrong (this is the default/web server user).
I have tried to do it using the contex part within the vhost by using perl regex say...
Which does pickup the php files, however it does the same thing i.e. using wrong PHP. You can test to make sure its doing what it should be by just adding say a X-TEST: Yes flag and confirming via curl -i that its picking up the extra header and this does work as intended, however its using the wrong PHP (not using vhosts level like it should be).
If I remove the expires on PHP pages, it works as it should i.e. using vhost level php settings/user as shown below..
Which is correct. It seems as soon as your using PHP expire settings whether its done via general or contex via regex, it just breaks it all. I have even tried to use the regex and just use the default expire settings box but but it does the same.
What I was trying to do to make it easier to mirgrate some stuff over was to use contex based expire based of file extention not by type as thats how the existing setup is, however doing it either way doesn't work as it should.
Now I can syslink the same version I use for vhost level php for default i.e. replace php7 with php5 however theres no point as the php is still being ran as the wrong user anyway even tho the settings are correct even on the server level, its as though it just ignores everything.
I hope this all makes sence, if not or you require further information, please drop me a line and I do my best as I would really like to be able to have custom header info and expires on php files as some users want their php files cached and others do not.
I believe I have found an error/bug on Litespeed Web Server Open 1.4.13.
This is very easy to duplicate and can be done a couple of ways but first let me try and explain what I am trying to achive.
What I would like to do is add a few extra headers as well as adding expire times when your accessing php files. To be exact I am trying to add the following..
Expire by Type
application/x-httpd-php=A0, application/x-httpd-php-source=A0, application/x-httpd-php3=A0, application/x-httpd-php3-preprocessed=A0, application/x-httpd-php4=A0, application/x-httpd-php5=A0
Extra Headers
Cache-Control: "no-store, no-cache, must-revalidate, max-age=0"
Pragma: "no-cache"
Now if you add the Expire by Types on the vhost level general page and then try and curl -i URL, you will find that its actully using the default/server level PHP and if your using SuEXEC by Daemon (like I am), it knocks it off (uses default user of web server) even tho its also set on server level as well to use SuEXEC. You can see below...
HTTP/1.1 200 OK
X-Powered-By: PHP/7.0.0RC5
Content-Type: text/html; charset=UTF-8
Date: Sun, 08 Nov 2015 16:49:47 GMT
Server: LiteSpeed
Cache-Control: public, must-revalidate, proxy-revalidate
X-Powered-By: PHP/7.0.0RC5
Content-Type: text/html; charset=UTF-8
Date: Sun, 08 Nov 2015 16:49:47 GMT
Server: LiteSpeed
Cache-Control: public, must-revalidate, proxy-revalidate
Do note that this Cache-Control flag is being pulled atm from the contex of / but was in the middle of changing to use regex solution so I can have a differernet header based of file types. However with this on or off, makes no difference due to this bug.
The reason why I noticed this error was because I still have the X-Powered-By flag still turned on the default/server level and is runnning PHP7 vrs my usual vhost level PHP 5.1.16 else I may of not noticed for a while.
You can also confirm that the user is wrong by using some simple PHP code..
<?php system('whoami'); ?>
If you curl that url you will get..
HTTP/1.1 200 OK
X-Powered-By: PHP/7.0.0RC5
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 08 Nov 2015 16:53:18 GMT
Server: LiteSpeed
Cache-Control: public, must-revalidate, proxy-revalidate
X-Powered-By: PHP/7.0.0RC5
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 08 Nov 2015 16:53:18 GMT
Server: LiteSpeed
Cache-Control: public, must-revalidate, proxy-revalidate
www-data
Which is very wrong (this is the default/web server user).
I have tried to do it using the contex part within the vhost by using perl regex say...
exp:.*(?hp|cgi|pl)$
Which does pickup the php files, however it does the same thing i.e. using wrong PHP. You can test to make sure its doing what it should be by just adding say a X-TEST: Yes flag and confirming via curl -i that its picking up the extra header and this does work as intended, however its using the wrong PHP (not using vhosts level like it should be).
If I remove the expires on PHP pages, it works as it should i.e. using vhost level php settings/user as shown below..
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 26
Date: Sun, 08 Nov 2015 16:55:59 GMT
Server: LiteSpeed
Cache-Control: public, must-revalidate, proxy-revalidate
testsite5.example.co.uk
Content-Type: text/html; charset=UTF-8
Content-Length: 26
Date: Sun, 08 Nov 2015 16:55:59 GMT
Server: LiteSpeed
Cache-Control: public, must-revalidate, proxy-revalidate
testsite5.example.co.uk
Which is correct. It seems as soon as your using PHP expire settings whether its done via general or contex via regex, it just breaks it all. I have even tried to use the regex and just use the default expire settings box but but it does the same.
What I was trying to do to make it easier to mirgrate some stuff over was to use contex based expire based of file extention not by type as thats how the existing setup is, however doing it either way doesn't work as it should.
Now I can syslink the same version I use for vhost level php for default i.e. replace php7 with php5 however theres no point as the php is still being ran as the wrong user anyway even tho the settings are correct even on the server level, its as though it just ignores everything.
I hope this all makes sence, if not or you require further information, please drop me a line and I do my best as I would really like to be able to have custom header info and expires on php files as some users want their php files cached and others do not.
Last edited: