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


Well-Known Member
As I just found out LSWS doesn't accept more than 1 response header with the same name if headers are set with 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?


Well-Known Member
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.


Well-Known Member
Staff member
Yes, PHP, Apache returns the same as designed. The following is the return by your php code from apache.
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


Well-Known Member
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?
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.

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