litespeed issue with json

#1
Hi,

I am running magento with litespeed.

The problem I am facing is that ajax call is being made of which header is set as x-json, but lightspeed is setting another header of text/html content type

I've checked that page with apache and everything is working fine.



I checked the response headers with apache and litespeed and here are they:

With apache:

HTTP/1.1 200 OK
Date: Fri, 07 Sep 2012 05:58:47 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: frontend=164b21c64808a05e806027bdbd4d745d; expires=Fri, 07-Sep-2012 06:58:48 GMT; path=/; domain=mydomain.com; httponly
Connection: close
Transfer-Encoding: chunked
Content-Type: application/x-json



With litespeed:

HTTP/1.1 200 OK
Date: Fri, 07 Sep 2012 06:10:55 GMT
Server: LiteSpeed
Connection: close
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: frontend=164b21c64808a05e806027bdbd4d745d; expires=Fri, 07-Sep-2012 07:10:55 GMT; path=/; domain=mydomain.com; httponly
Content-Type: text/html; charset=UTF-8
Content-Length: 474
Vary: User-Agent


I've also added application/json to mime.properties of litespeed,restarted it but that did not work.
 
Last edited:

NiteWave

Administrator
#2
my test:

before add
json application/json
into mime.properties,

#curl -I 127.0.0.1/a.json
HTTP/1.1 200 OK
Date: Fri, 07 Sep 2012 12:26:01 GMT
Server: LiteSpeed/4.1.13 Enterprise
Accept-Ranges: bytes
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
ETag: "27-5049e7af-f782c3"
Last-Modified: Fri, 07 Sep 2012 12:25:19 GMT
Content-Type: application/octet-stream
Content-Length: 39

after add,

#curl -I 127.0.0.1/a.json
HTTP/1.1 200 OK
Date: Fri, 07 Sep 2012 12:28:23 GMT
Server: LiteSpeed/4.1.13 Enterprise
Accept-Ranges: bytes
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
ETag: "27-5049e7af-f782c3"
Last-Modified: Fri, 07 Sep 2012 12:25:19 GMT
Content-Type: application/json
Content-Length: 39

so it's working as expected.

the server's mime setting may be overwritten in .htaccess or php script.

can you put an sampe a.json in your document root and do same tests as I did.
 
Last edited:
#3
Hi,

Thanks for the suggestion. I will check this one.

I would like to add that I checked the same page with apache on the same server and it is working fine with apache.

All i did was shifted from litespeed to apache from litespeed admin panel, then tested this page and it worked as expected. Don't know why it gives text/html header every time with litespeed.

I will post my findings..
 
#4
Hi again,

I checked with .json file and server does return application/json this time.

But I still don't know why it's returning two content-type headers on that case..
 
#6
Hi,

I added that but it's still not working.

I've added a screenshot link to have a view where multiple content-types are returned.

I just want for that particular page text/html should not come in http response.
Here is the link of the image
 

webizen

Well-Known Member
#16
Seems you missed my reply pm.

Basically, we could not reproduce the issue you described (two content-type in server response header). We tested with Firefox, Chrome, Safari only see ONE content-type either application/x-json or text/html but NOT both.
 
#17
Seems you missed my reply pm.

Basically, we could not reproduce the issue you described (two content-type in server response header). We tested with Firefox, Chrome, Safari only see ONE content-type either application/x-json or text/html but NOT both.
I think this may have something to do with litespeed's anti-ddos measures. I'm experiencing something similar right now with CURL and file_get_contents connections.
 
Top