[solved] Auto Index not working

Discussion in 'General' started by sophrosyne, Feb 27, 2012.

  1. sophrosyne

    sophrosyne New Member

    Hi,

    lsws 4.1.10
    CentOS release 6.2 (Final)

    I am getting an error when 'Options +Indexes' is enabled in a directory's .htaccess file. Litespeed is returning a 'Content-Type: handler/x-httpd-php', which triggers the browser to try and download the file.

    How can we get litespeed to create the auto index page properly?

    Thank you,
    Last edited by a moderator: Mar 8, 2012
  2. sophrosyne

    sophrosyne New Member

    Any update/advice?
  3. webizen

    webizen New Member

    is this native lsws vhost or apache vhost?

    you can try followings and see if your issue goes away.
    1. force reinstall 4.1.10
    or
    2. upgrade to 4.1.11
  4. sophrosyne

    sophrosyne New Member

    We're using apache vhost. Auto Index is set to "Yes" in litespeed config. Unfortunately force reinstall didn't work, and I don't see a 4.1.11 available. (we're running enterprise)
  5. sophrosyne

    sophrosyne New Member

    Any update on this?
  6. webizen

    webizen New Member

    You can manually download 4.1.11 package from http://www.litespeedtech.com/litespeed-web-server-downloads.html since auto-update has not enabled for 4.1.11. run upgrade by unpack the package and run ./install.sh from there (choose 'U' option for upgrade when prompted).

    BTW, does the setup work for Apache? We could not replicate the issue in our lab. Hence the question.
  7. aheadley

    aheadley New Member

    I'm a co-worker of sophrosyne. The 4.1.11 update did not fix the issue, though now instead of the incorrect content type we just get a 404 from litespeed. Here is a (anonymized) snippet of the logs from 4.1.11 with the 404:
    http://pastebin.com/2N7CxdAK
    The request was for http://example.com/docs/ which points at /home/username/example.com/html/docs/ . There is a .htaccess file in that directory containing (only) "Options +Indexes". It also seems to make no difference if we have the Auto-Index setting set to "Yes" or "Not Set".
  8. webizen

    webizen New Member

    Looks like .htaccess is not honored in apache. It would not be honored in lsws either.

    Change it to something like

  9. aheadley

    aheadley New Member

    Sorry for the confusion, the 404 error was caused by a change the client made to their htaccess file (and the AllowOverride None line). I setup a small test case so that doesn't happen again and it looks like the "Content-type: handler/x-httpd-php" issue is still occuring in 4.1.11 . Here is another snippet of the log from a response with the wrong content-type header:
    http://pastebin.com/kH171g3T

    And the curl request that generated it:
    http://pastebin.com/cMXLvujy
  10. webizen

    webizen New Member

    following response header for php is not right.
    put something like the following in .htaccess to override it.
  11. aheadley

    aheadley New Member

    Adding "AddType application/x-httpd-php .php" to the .htaccess file made no difference. Also, requests for regular PHP files (like example.com/ai-test/test.php) work fine, as in they are properly run through PHP, even without the AddType line. It's just the auto-index script builtin to LS that has this problem. Additionally, the "Content-Type: handler/x-httpd-php" header is causing the browser to throw up a file download prompt but I think we forgot to mention that the contents of that file are the un-interpreted auto-index PHP script.
  12. webizen

    webizen New Member

    You have this in your vhost conf. That's why suggest earlier to add "AddType application/x-httpd-php .php" in .htaccess to override it.
    Are you saying http://example.com/ai-test/test.php is ok (php serves) but http://example.com/ai-test/ (default.php) is not? Comment out the "AddHandler" pointed out above and see any difference.
  13. aheadley

    aheadley New Member

    Yes, that's right.

    This made no difference, still getting the "Content-type: handler/x-httpd-php" header.

    Also, it looks like the same thing happens on CentOS 5 servers as well.
  14. webizen

    webizen New Member

    pls pm server temporary access for us to look into further.
  15. aheadley

    aheadley New Member

    While setting up a test environment to give your root access we discovered that it was a problem with our configuration. For future reference, the issue was that these lines were missing from the apache config files (loaded by Litespeed of course):
  16. NiteWave

    NiteWave Administrator

    Thanks for the update.

Share This Page