0

I'm having trouble with ajax in the workbench email module. On two nodes (out of hundreds), the ajax call to get a list of users to notify when the publication status changes will fail. The error is "Invalid form POST data". I added watchdog logging, and actually the entire $_POST is missing when the ajax fires. Does anyone know what would cause that?

I can't reproduce this in our development environment. I copied the database down, and the codebase is the same, but the same node works just fine in dev.

I've turned off boost caching on the live site and deleted the cache, and that did not help (although it's a node edit form, so I didn't think caching should matter).

It's consistently happening to the same two nodes, but I can't see anything different about them than the other nodes that work without issue.

One more thing -- I am using the Ajax Debugger chrome extension, and postData is populated in the request object with all of the form data and sent to the server. So it must be something in the drupal_bootstrap to remove $_POST data, but I'm stumped.

5
  • 1
    So it must be something in the drupal_bootstrap to remove $_POST data Drupal doesn't do that, it's far more likely to be your server settings. Make sure your max post size and similar vars are sensible
    – Clive
    Aug 7, 2014 at 14:56
  • Thanks, Clive. I forgot to mention that I checked that too. Here are the pertinent settings. They are the same or better than my settings on the dev server: post_max_size 256M max_execution_time 60 max_file_uploads 20 max_input_nesting_level 64 max_input_time 60 max_input_vars 2000
    – JuliaK
    Aug 7, 2014 at 15:04
  • It's hard to guess what could be happening...I think the easiest thing you can do in the short term is add a bunch of watchdog('MYMODULE', '<pre>' . print_r($_POST, TRUE) . '</pre>'); to various points in the bootstrap to see when it's failing. It might not help you fix it but would at least give us something more to go on
    – Clive
    Aug 7, 2014 at 15:05
  • I'll do further logging and post results. Thanks!
    – JuliaK
    Aug 7, 2014 at 15:13
  • Also, whoever downvoted the question -- could you let me know why? I'm happy to change what I'm doing if I did something wrong, but there's no feedback to let me know what I did to warrant the downvote. Thanks!
    – JuliaK
    Aug 7, 2014 at 15:15

1 Answer 1

2

Thanks to Clive's suggestions, I logged the request and post data before the Drupal bootstrap kicked in, and found that it was not Drupal causing the issue.

The root cause was two different mod_security violations: PCRE limits exceeded and matching rule 300016 (Generic SQL injection protection). Increasing the PCRE limit and adding an exception for the SQL Injection rule:

<LocationMatch "/system/ajax">
  SecRuleRemoveById 300016
</LocationMatch>

Just for the record, I got the idea that Drupal might strip out $_POST data from this comment: https://www.drupal.org/node/2209051#comment-8539311 I came across it trying to troubleshoot this issue earlier. Maybe I misunderstood or took it out of context. This was a hard one for me to figure out, and I was grasping for anything that sounded close to my issue. Thanks for the help, Clive!

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.