NextGen Gallery issues with W3TC Cloudflare Extension
WordPress…you fix one issue and another two issues show up right after you sorted the initial problem. I recently added Cloudflare support to WordPress by enabling the Cloudflare Extension in W3 Total Cache. Things worked great, page loading time and requests went way down compared to running this site without Cloudflare support. So far, so good. Today i was thinking of rearranging the Galleries on this page as i am not really happy with the “Page per Gallery” solution, so i started messing with different ways to display albums on a single page. With the site and plugins working fine, i didn’t expect it to turn into a problem of catastrophic proportions hehe. Right now i am staring at lines of code of the WordPress core files and the plugin that, according to my research, is causing the problem.
When i tried adding a NextGen Gallery or an NextGen Album to a page or post it always resulted in a pop-up window displaying an extremely verbose and helpful error message. After selecting the view of the NextGen Gallery and selecting which NextGen Gallery albums and/or galleries to display and trying to save the settings a pop-up window appeared and all it said was “Invalid Request“. You have to admit that this error message is extremely detailed, innit? Checked the server error logs to no avail:
[Sat Sep 27 08:23:27 2014] [error] [client 188.8.131.52] Directory index forbidden by Options directive: /home/habschne/public_html/photos/
[Sat Sep 27 08:23:24 2014] [error] [client 184.108.40.206] Directory index forbidden by Options directive: /home/habschne/public_html/photos/
[Sat Sep 27 08:23:19 2014] [error] [client 220.127.116.11] Directory index forbidden by Options directive: /home/habschne/public_html/photos/
[Fri Sep 26 12:47:51 2014] [error] [client 18.104.22.168] File does not exist: /home/habschne/public_html/wp-content/cache/minify/000000/$1
W3TC seems to cause NextGen Gallery to fail
That’s all that showed up in the logs. Nothing helpful, no entry for the NextGen Gallery plugin. So i went the usual way to sort out WordPress problems that appear to be related to plugins. I disabled all plugins except for the NextGen Gallery. With plugins disabled adding Albums or Galleries to posts and pages was no problem. I then enabled a bunch of plugins again, checked if adding Galleries or Albums still works and if it did i enabled the next bunch of plugins. About an hour later i had only one plugin left to enable, which was W3 Total Cache (W3TC). After activating it and adding Galleries or Albums the pop-up error with “Invalid Request” showed up again. So the problem had to be with W3TC and since i didn’t change anything in W3TC except for enabling Cloudflare support i figured it would be worth a shot to disable options that might interfere with adding images.
Temp Workaround to add NextGen Gallery Albums
Disabling the Cloudflare Extension in W3TC solved the issue, after deactivating it i was able to add Galleries and Albums no problem. Turning the extension back on and boom…..Invalid Request error was back. So the entire problem of not being able to add NextGen Gallery Albums and/or Galleries is caused by the Cloudflare Extension in W3 Total Cache. Now it’s time to contact the developers of those plugins, letting them know about what i found out and trying to figure out if it might be related to one of the plugins or (which i don’t expect it to be) a problem with my server setup. Anyway, for now the only workaround for me is to disable the extension when adding posts or pages that contain a NextGen Gallery Album or a NextGen Gallery Gallery.