When I try to add content or resources folder I get error message - why?

Hi,

I’m slowly moving my classic site over to Elements - for the most part, it has been seamless, and as I’ve got to grips with it, I’m seeing what amazing things it can do.

I’ve run into a problem with CMS that I’m not able to resolve. When I first set it up, I didn’t have this issue. But now I get the ‘Failed to Browse Directory’ warning. Why is this? And how do I fix it?

Any help appreciated. Thank you!

Hi @RichardPhoto

Really pleased to hear the move over from Classic has been going smoothly :smiley: but sorry to hear you’ve hit an issue with the CMS. I’ll try and help you out!

That “Failed to browse directory” message doesn’t mean the folder is missing or unreadable, it means the Online Editor didn’t get a valid response back from your server. Nine times out of ten that’s your host blocking the request.

Here’s a quick way to narrow it down. Log into your CMS editor as normal, then in the same browser open a new tab and go to https://your-site.com/rw/elements/com.elementsplatform.cms/editor/api.php?action=browse (obviously change “your-site.com” to your domain name)

Then let me know which of these you get:

  • A wall of raw text starting with {"current":"/home/... — that’s the healthy response, so something else is going on and I’ll dig further.
  • “403 Forbidden”, “Access Denied”, or a security/firewall page — your host’s firewall is blocking it. This is the most common cause by a mile.
  • A PHP warning or error page — that’ll tell us exactly what your server is unhappy about.

My best guess is it will be the firewall issue. When you browse for a folder, the editor asks your server for a directory listing and passes the folder path along with the request. Some hosts see a file path in a web request, assume it’s an attack, and block it before it ever reaches the CMS. It can start happening out of the blue after a host tightens their rules or moves you to a new server. This might explain why it worked fine when you first set things up.

If that turns out to be it, a quick message to your host asking them to relax mod_security for your CMS folder usually sorts it in minutes.

Couple of other things that would help me:

  • Who’s your hosting with, and which PHP version are you on?
  • Has anything changed on the hosting side since you first set up the CMS — a server move, a PHP update, or a new security add-on?

Let me know how you get on :slightly_smiling_face:

Thanks!
Thanks @ben

I got the first of the three options. Then reading your message in full I double checked my VPN settings. Although I’d turned the security off, I’d not disabled the malware protection. It turns out that was blocking it. Thanks - sorted now!