1

CiviCRM 5.6.1, WordPress 4.9.8, PHP 7.1.22, MySQL 5.7.23, WordFence 7.1.16

I just started getting this error when trying to create a mailing. It happens with Mosaico and traditional mailings. I previously saw this issue when first using the WordFence security plugin and found a discussion here suggesting to disable WordFence's XSS check, which I did with success until now. That was months ago. The option is still disabled and I even tried disabling WordFence entirely, but no luck. I haven't made any significant changes recently that I can think of. I had no problems with my last weekly mailing.

I also checked with my hosting provider to see if they had made any mod_security rules changes. They hadn't. I don't see anything interesting in the logs. Any ideas?

1
  • I am also seeing this error on my personal dev box. It's just a linux box in my closet, not hosted. It has basically the same configuration, minus the WordFence plugin. Commented Nov 6, 2018 at 1:38

3 Answers 3

6

I have seen this error occur on WordPress due to a false positive generated in WordFence security plugin.

If that might be your issue, put WordFence Firewall back into "Learning Mode", try saving/testing a Mosaico template email again in Civi and - if that is the problem - then WordFence should Whitelist the action, and the error should disappear.

3
  • This worked for me. Thanks.
    – Graham
    Commented Dec 31, 2019 at 15:26
  • 2
    Helped me too, though a colleague later said " just try saving the mailing then go into wordfence find the relevant request and whitelist it. That way you are not disabling the functionality while it learns."
    – petednz - fuzion
    Commented Apr 22, 2020 at 21:53
  • 2
    There are some more detail instructions here: github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/… Commented Apr 22, 2020 at 21:55
4

I've run into this error for three reasons:

1: I copied and pasted in text and there was a special character in there that CiviCRM did not like. I figured out which one it was by pasting in only pieces of the text and watching to see when it quit saving and instead gave me the error.

2: I'd upgraded CiviCRM and the permissions weren't correct on some files (I'm logged in as root and therefore have to change owner/group when I upload).

3: A modsecurity issue. My host was able to look at the logs and whitelist the URI that was causing the issue. Last time it was: /civicrm/ajax/rest

2
  • 2
    Aha! This definitely helped.... I was failing with new, blank (no template) mailings, so I didn't think it could be #1. I hadn't upgraded since my most recent successful mailing, so I didn't think it could be #2. My dev box doesn't use mod_security, so I didn't think it was #3, but your mention of "/civicrm/ajax/rest" reminded me that I had applied a small patch for REST.php that was provided by the developers of CiviMobileAPI as a proposed fix for a login issue on WordPress. I offered to test it a few days ago and I apparently forgot to revert! That was it. Thanks! Commented Nov 6, 2018 at 6:42
  • Yay! Glad to hear that I at least got your mind thinking in the right direction. Sometimes that's all it takes. :D Commented Nov 7, 2018 at 0:41
2

I had this issue too and the solution was a twist on Jenni Simonis's answer so I'll elaborate in case anyone else runs into it.

The specific thing that fixed it for me was granting user & group execute permissions on the wordpress file wp-admin/admin.php.

I was getting a 403 forbidden error in the JS console on this file any time CiviCRM tried to take some kind of ajax action because it was trying to post to /civicrm/ajax/rest through admin.php but didn't have the right permissions.

3
  • Welcome to CiviCRM.SE. The number next to a question or answer does not indicate its sequence, but the number of votes it has received; I have altered the reference in your post as a result. This is not a discussion forum, but a Q&A site, and if you are new to Stack Exchange, I would strongly recommend you take the site tour and review the help center.
    – choster
    Commented Mar 29, 2019 at 12:18
  • thanks @choster :) Commented Mar 30, 2019 at 13:32
  • I still have this issue on WordPress the error I'm getting in the chrome console is "POST example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/ajax/… 500"jquery.min.js?r=p6mna:4 Anyone know what this can be? or how to fix it?
    – netzih
    Commented Oct 4, 2019 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.