[solved] Bug or Feature: LSWS doesn't accept more than 1 response header with the same name

serpent_driver

Well-Known Member
#1
As I just found out LSWS doesn't accept more than 1 response header with the same name if headers are set with PHP.

PHP:
header (test: test1");
header (test: test2");
....
Only the last header is set. Is it a bug or feature or part of design? Any workaround?
 

serpent_driver

Well-Known Member
#3
Yes, but we are talking about PHP, not .htaccess. Either LSWS doesn't allow to set headers with the same name or I don't know how to "append" headers with the same name in PHP, but different value.
 

Pong

Administrator
Staff member
#4
Yes, PHP, Apache returns the same as designed. The following is the return by your php code from apache.
Code:
Request Method: GET
Status Code: 200 OK
Remote Address: :443
Referrer Policy: strict-origin-when-cross-origin
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Date: Thu, 19 Nov 2020 18:46:38 GMT
Keep-Alive: timeout=5, max=100
Server: Apache
test: test2
Transfer-Encoding: chunked
 

serpent_driver

Well-Known Member
#5
Sorry for delay to reply. I had to verify Apache behavior first and you are right. But my problem still exists. As described in section "x-litespeed-purge" in documentation: https://docs.litespeedtech.com/lscache/devguide/controls/#x-litespeed-purge if this header is used to purge specific cache only tags or only URLs can be purged, but tags and URLs can't be used together within 1 purge header. Due restriction of not setting more than 1 header with the same name I am in a dead end how to solve it.

Any ideas?
 

serpent_driver

Well-Known Member
#10
I've just tested it and can confirm that it works:

2 pages, 1 has private cache, the other one public with cache tag. Cache of both pages will be purged.

Code:
header("X-LiteSpeed-Purge: example_tag");
header("X-LiteSpeed-Purge: private, *", false);
 
Top