• Resolved Max

    (@makspostal)


    Hi,

    After update CF till v.4.8 doesn’t work Submit button on all my websites anymore.

    Errors:
    jquery.js?ver=1.12.4:4 GET /wp-json/contact-form-7/v1/contact-forms/4/refill 404 (Not Found)
    POST /wp-json/contact-form-7/v1/contact-forms/4/feedback 404 (Not Found)

    Tell please, how to fix it?

    • This topic was modified 7 years, 5 months ago by Max.
Viewing 15 replies - 16 through 30 (of 40 total)
  • It is related to rest API. We have it disabled for performance issues and ran into this same problem. Installed 4.7 and all is good.

    Thanks. All works. Rolling back to 4.7

    I just had the same issue, in my case there was a security related plugin (cerber) disabling REST API calls.

    Anyone facing 404 errors when submitting CF7 version 4.8, I suggest you disable security plugins and teste CF7 again. The security plugin I use have an option to stop it messing with REST API calls, so it was an easy fix.

    Hope that helps.

    Thread Starter Max

    (@makspostal)

    Hi,

    I use this code to disable Rest API and prevent multiple page dublicates:

    // Disable REST API
    add_filter('rest_enabled', '__return_false');
    
    // Disable diltres REST API
    remove_action( 'xmlrpc_rsd_apis',            'rest_output_rsd' );
    remove_action( 'wp_head',                    'rest_output_link_wp_head', 10, 0 );
    remove_action( 'template_redirect',          'rest_output_link_header', 11, 0 );
    remove_action( 'auth_cookie_malformed',      'rest_cookie_collect_status' );
    remove_action( 'auth_cookie_expired',        'rest_cookie_collect_status' );
    remove_action( 'auth_cookie_bad_username',   'rest_cookie_collect_status' );
    remove_action( 'auth_cookie_bad_hash',       'rest_cookie_collect_status' );
    remove_action( 'auth_cookie_valid',          'rest_cookie_collect_status' );
    remove_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
    
    // Disable events REST API
    remove_action( 'init',          'rest_api_init' );
    remove_action( 'rest_api_init', 'rest_api_default_filters', 10, 1 );
    remove_action( 'parse_request', 'rest_api_loaded' );
    
    // Disable Embeds linkied with REST API
    remove_action( 'rest_api_init',          'wp_oembed_register_route'              );
    remove_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
    
    remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
    // если собираетесь выводить вставки из других сайтов на своем, то закомментируйте след. строку.
    remove_action( 'wp_head',                'wp_oembed_add_host_js'                 );

    But if I delete this code from function.php of my theme it doesn’t help solve the problem with CF7 4.8.

    Same issue. Rolled back.

    I have same issue. I solved.
    Just change htaccess permission 755

    Thread Starter Max

    (@makspostal)

    I have same issue. I solved.
    Just change htaccess permission 755

    I think it’s wrong decicion. We shouldn’t change permission of any files because of this problem.

    In my case, I had existing contact forms prior to upgrade to 4.8.1, I noticed that the REST API urls were returning 404 errors because the path became incorrect, it became
    /wp-json/contact-form-7/v1contact-form-7/v1/contact-forms/[id]/feedback instead of /wp-json/contact-form-7/v1/contact-forms/[id]/feedback

    Resaving all the forms corrected the path and fixed this issue for me

    Thread Starter Max

    (@makspostal)

    Hi Charton,

    This is solution. It works and in my case too.
    Thanks!

    I discovered a different cause and solution for this problem, which I’m sharing as it may benefit others with a similar setup to myself.

    After trying all the proposed fixes above without success, I was examining the AJAX request using the browser developer tools and noticed that the request to /wp-json/contact-form-7/v1/contact-forms/[ID]/feedback was being submitted as a GET, although the code indicated it should be sent as a POST.

    Some Googling led me to this article: https://blog.arvixe.com/why-is-jquery-ajax-sending-a-get-instead-of-a-post/ and I realised that my site was indeed appending a trailing slash, due to the configuration I have in place to maintain consistent URLs.

    Once I modified the relevant RewriteRule to exclude any API URLs, my forms started working as expected.

    Thread Starter Max

    (@makspostal)

    Hi genyus,

    Could you please give an example “Howto” for non-programmer people?

    Sure, I will try my best.

    1. You need to check if this scenario even applies to your site. The easiest way is to navigate to a URL on your site, e.g. https://mysite.com/about-us and see if a trailing slash is appended, i.e. the final URL ends up looking like https://mysite.com/about-us/.
      If it does, read on. If it doesn’t, this solution won’t apply to you and you should try the other fixes that have been proposed elsewhere.
    2. You’ll have to ascertain exactly how your trailing slashes are being enforced and this may require someone with with technical expertise. There are a few ways this may be implemented: .htaccess file configuration, PHP code or even with a custom plugin. I would expect .htaccess to be the most likely and is the mechanism that was in place on my own site. If you have custom code or a plugin managing this, then you’ll have to implement a relevant solution that I can’t provide here.
    3. Assuming .htaccess is the mechanism in use, simply add a RewriteCond condition excluding the /wp-json path to the relevant RewriteRule: RewriteCond %{REQUEST_URI} !^/wp-json/

    Permalinks caused the problem, thanks tom.andersen (@tomandersen) , I have tried to figure out what was happened for over an hour …. then looked in Google ,this forum and works like a charm now, thanks again.

    @charton
    This also fixed it for me.
    PS: don’t forget to clear ALL caches (cpanel, cloudflare, browser, W3TC, WPFC, …)!

    Has anyone had any luck with this? Still seems to be an issue.

    Still getting a 404 with the latest version.

    Regards
    Chris

Viewing 15 replies - 16 through 30 (of 40 total)
  • The topic ‘4.8 version doesn’t work’ is closed to new replies.