LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   General (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=25)
-   -   litespeed issue with json (http://www.litespeedtech.com/support/forum/showthread.php?t=6217)

sandeep.s85 09-07-2012 03:08 AM

litespeed issue with json
 
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.

NiteWave 09-07-2012 05:38 AM

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.

sandeep.s85 09-07-2012 07:20 AM

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..

sandeep.s85 09-07-2012 07:55 AM

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..

NiteWave 09-07-2012 08:03 AM

please try add following line in .htaccess under document root
Quote:

AddType application/json .json
to see if it becomes ok.

sandeep.s85 09-07-2012 08:11 AM

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
http://tinypic.com/r/2z7e5a8/6

sandeep.s85 09-07-2012 08:12 AM

http://tinypic.com/r/2z7e5a8/6

NiteWave 09-07-2012 08:31 AM

yes, it looks the problem is 2 Content-Type in response header

sandeep.s85 09-07-2012 09:12 AM

Yes, can it be removed or suppressed from litespeed response, because apache does not include that in response of the same page..

webizen 09-07-2012 01:52 PM

Quote:

Originally Posted by sandeep.s85 (Post 34942)
Yes, can it be removed or suppressed from litespeed response, because apache does not include that in response of the same page..

upgrade to the latest 4.1.13 see any difference.


All times are GMT -7. The time now is 04:53 AM.