litespeed issue with json

Discussion in 'General' started by sandeep.s85, Sep 7, 2012.

  1. sandeep.s85

    sandeep.s85 New Member

    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: Sep 7, 2012
  2. NiteWave

    NiteWave Administrator

    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: Sep 7, 2012
  3. sandeep.s85

    sandeep.s85 New Member

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

    sandeep.s85 New Member

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

    NiteWave Administrator

    please try add following line in .htaccess under document root
    to see if it becomes ok.
  6. sandeep.s85

    sandeep.s85 New Member

    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
    [​IMG]
  7. sandeep.s85

    sandeep.s85 New Member

  8. NiteWave

    NiteWave Administrator

    yes, it looks the problem is 2 Content-Type in response header
  9. sandeep.s85

    sandeep.s85 New Member

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

    webizen New Member

    upgrade to the latest 4.1.13 see any difference.
  11. sandeep.s85

    sandeep.s85 New Member

    Thanks,

    How can I update from cpanel/whm ?
  12. sandeep.s85

    sandeep.s85 New Member

  13. sandeep.s85

    sandeep.s85 New Member

    I updated the server to the latest version but still no luck..

    Problem persists..
  14. webizen

    webizen New Member

    pls pm the server temp root access to investigate further if you like.
  15. sandeep.s85

    sandeep.s85 New Member

    Hi There,

    Did you find anythign related to the header issue. I have already sent you the steps to reproduce the problem in a pm.


    Thanks
  16. webizen

    webizen New Member

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

    atwellpub New Member

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

    webizen New Member

    pls show your evidence.

Share This Page