File upload causes user session to terminate, logging me out

When trying to upload any kind of file, be it an image or a text file, i see the spinning icon and soon after that, I am logged out and brought to login page. There is no 500 error, no PHP error. I checked the redirect chain, all pages return 200.

Some notes:

  • I can edit existing files, including renaming them (demo files)
  • I can manually upload files using scp, they appear in Kirby
  • I can delete existing files
  • I verified that folder permissions are correct, even set to 777 just in case.
  • No custom settings
  • Running lighttpd (might be an issue?)

Running ubuntu 14.04, php 5.5.9

Keep in mind, this does not seem related to the file size or type. Even the smallest of files, any file type, like txt or html, triggers this. If someone has any ideas, I would appreciate it. Don’t have time to dig into that code right now.

I also noticed that during the upload process, my session is actually terminated. Maybe a CSRF issue?

Greatful for any ideas.

lighttpd is not officially supported, but should nevertheless work.

Since you can’t upload any files, the first thing I would check is if

file_uploads = On

is set in your php.ini file.

Edit: Are you using a fresh starterkit or did the problem pop up on updating Kirby?

same issue for another user

Manged to solve my issue with this rewrite rule:

url.rewrite-if-not-file = (
    "^/panel/(.*)$" => "/panel/index.php$0",
    "^/(.*)$" => "/index.php$0"
)

Note the $0 at the end.

The entire lighttpd virtualhost

$HTTP[“host”] == “foo.com” {

server.document-root         = "/opt/kirby/"
url.rewrite-once = (
    "^/content/(.*)\.txt$" => "/index.php",
    "^/(site|kirby)/(.*)$" => "/index.php"
)
url.rewrite-if-not-file = (
    "^/panel/(.*)$" => "/panel/index.php$0",
    "^/(.*)$" => "/index.php$0"
)
fastcgi.server = (
    ".php" =>
    ( "localhost" =>
     (
        "socket" => "/var/run/lighttpd/pbapp-php-fastcgi.socket",
        "bin-path" => "/usr/bin/php-cgi"
     )
    )
)

}