LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > litespeed issue with json

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2012, 03:08 AM
sandeep.s85 sandeep.s85 is offline
Member
 
Join Date: Sep 2012
Posts: 11
Default 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.

Last edited by sandeep.s85; 09-07-2012 at 09:36 AM..
Reply With Quote
  #2  
Old 09-07-2012, 05:38 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
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 by NiteWave; 09-07-2012 at 08:35 AM..
Reply With Quote
  #3  
Old 09-07-2012, 07:20 AM
sandeep.s85 sandeep.s85 is offline
Member
 
Join Date: Sep 2012
Posts: 11
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..
Reply With Quote
  #4  
Old 09-07-2012, 07:55 AM
sandeep.s85 sandeep.s85 is offline
Member
 
Join Date: Sep 2012
Posts: 11
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..
Reply With Quote
  #5  
Old 09-07-2012, 08:03 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
please try add following line in .htaccess under document root
Quote:
AddType application/json .json
to see if it becomes ok.
Reply With Quote
  #6  
Old 09-07-2012, 08:11 AM
sandeep.s85 sandeep.s85 is offline
Member
 
Join Date: Sep 2012
Posts: 11
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
Reply With Quote
  #7  
Old 09-07-2012, 08:12 AM
sandeep.s85 sandeep.s85 is offline
Member
 
Join Date: Sep 2012
Posts: 11
http://tinypic.com/r/2z7e5a8/6
Reply With Quote
  #8  
Old 09-07-2012, 08:31 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
yes, it looks the problem is 2 Content-Type in response header
Reply With Quote
  #9  
Old 09-07-2012, 09:12 AM
sandeep.s85 sandeep.s85 is offline
Member
 
Join Date: Sep 2012
Posts: 11
Yes, can it be removed or suppressed from litespeed response, because apache does not include that in response of the same page..
Reply With Quote
  #10  
Old 09-07-2012, 01:52 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
Quote:
Originally Posted by sandeep.s85 View Post
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.
Reply With Quote
Reply

Tags
litespeed json

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:18 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.