Addpixel / KirbyComments

[Kirby 2] File-based comments stored as subpages for the Kirby CMS.
MIT License
68 stars 5 forks source link

Plugin not working with enabled cache #12

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi, I'm currently struggling with the setup on my Uberspace instance. The plugin fails without a error code. On my local XAMPP instance, everything works fine. I've tried setting the permissions to 755, at least in some cases the comments folder is created fine.

Do you have an idea what could be wrong?

florianpircher commented 7 years ago

The demo at https://kirby-comments.addpixel.net/demos/comments is running on a Uberspace, too. Kirby Comments does return a status when processing the HTTP-data and the file-system, but it only shows errors generated by users (in snippets/comments.php at line 36 and 38). Please insert the following line after the second line in snippets/comments.php. (Just for debugging)

<?php echo $status->getCode() ?>

This outputs the status code in all cases. Please post that status code so I know where in the the system the error occurs.

ghost commented 7 years ago

Don't be surprised, the status code is 0. And commenting still doesn't work as expected, you can try it yourself. And if needed, the source code of my website is on GitHub.

florianpircher commented 7 years ago

Hm, interesting… Your source-code seems to be OK. It works on your local machine using XAMPP, so I suspect it has something to do with your server setup.

lukasleitsch commented 7 years ago

@jlnostr You have the cache enabled. Did you tried to disable the cache for the article? If the cache enabled the post request is not working.

In the next version of Kirby the cache will be not use for post requests. getkirby/kirby#559

florianpircher commented 7 years ago

Interesting note! Kirby Comments does not work with cache enabled, so this could be the problem. Kirby not enabling the cache for POST requests is great news. Unfortunately Kirby Comments also requires no cache on the first (non POST) visit in order to generate a random token for blocking Cross-site request forgery.

Currently this random token is required for comment preview and submission. I have to look into the security implications of making this token optional for the preview, thus allowing a cached version of the form to request a preview.

ghost commented 7 years ago

@lukasleitsch Never tried it. In the end, I've built my own solution based on @schmidtflo's blog posts. Nevertheless, it's nice to see this improved in the future 👍

florianpircher commented 7 years ago

Kirby Comments now plays nicely with the new caching behavior in Kirby v2.5. Therefore, Kirby Comments is now usable on a site with enabled caching. A working version is already on the develop branch. In the following days I am going to move it to master and publish a new release.

florianpircher commented 7 years ago

This has been fixed in 1.4.1.