• Resolved poemoe

    (@poemoe)


    Hello!

    First of all I want to thank you for a wonderful plugin that I have used for many years on many sites. But now I have encountered a problem that I cannot solve:

    My site is using http / ssl and some time ago the contact form stopped working.

    When I look into the console I see this message:

    Mixed Content: The page at 'https://www.page-name.se/salja/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'https://www.page-name.se/wp-json/contact-form-7/v1/contact-forms/79/feedback/'. This request has been blocked; the content must be served over HTTPS.

    So my question is first of all if contact form 7 does work with SSL sites. The other question would be if it can be a problem with the wp api instead.

    How would I solve this?

    Thanks in advance.

    /Daniel

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    So my question is first of all if contact form 7 does work with SSL sites.

    Yes.

    The other question would be if it can be a problem with the wp api instead.

    No.

    What do you have in the WordPress Address and Site Address fields in the Settings > General admin menu?

    Thread Starter poemoe

    (@poemoe)

    Ok,

    Thank you for your quick answers.

    In those two fields I have the same value: https://www.example.se.

    /Daniel

    following

    Thread Starter poemoe

    (@poemoe)

    Bump…

    I have investigated even further. Everywhere, both in the database and at the settings page, the site address is with ssl.

    /Daniel

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    What other plugins and theme do you use?

    Thread Starter poemoe

    (@poemoe)

    Hi!

    This is the plugins I am using:

    Advanced Access Manager
    Advanced Custom Fields
    Advanced Custom Fields: Flexible Content Field
    Advanced Custom Fields: Options Page
    Advanced Custom Fields: Repeater Field
    Contact Form 7
    Duplicate Post
    MailChimp for WordPress
    Simple 301 Redirects
    Wordfence Security
    WP Smush
    WP-Mail-SMTP
    V?lj Yoast SEO

    /Daniel

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the site?

    Thread Starter poemoe

    (@poemoe)

    I managed to fix the problem yesterday.

    Thank you very much Takayuki for your time.

    After you asked which plugins I used I started to turn my plugins on and off to see what plugins maybe could have caused the problems. No of the plugins did anything; better or worse.

    So I started looking at my htaccess file and started to commenting out rules one by one.

    It turned out that it was three lines of htaccess-code that was my problem. It was htaccess code that added a trailing slash on my urls. Don’t remember if I added those lines there myself or if a plugin once did it.

    Anyway, now everything is working fine and maybe someone can read this and get some help.

    Thanks for your time Takayuki!

    /Daniel

    I’m having the same issue. Is the only solution to change those files in htaccess?

    I having same issue.

    How I fix that?

    Thanks

    I’m having the same issue. Is the only solution to change those files in htaccess?

    Hey Guys!
    I think I have found the cause of the problem and therefore the solution. Thanks to this thread.

    My .htaccess has a rule to force a trailing slash after all URLs. The rule is:

    # Force trailing slash
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ https://mysite.com.br/$1/ [L,R=301]
    

    So, as @mikele3 explained in the thread linked above, this redirection was forcing all URLs to have a “/” in the end, including the wp-json path, which is used by Contact Form 7 after the 4.8 upgrade.

    I just have to add an exception in .htaccess to not redirect the /wp-json path. The final snippet is:

    # Force trailing slash
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteCond %{REQUEST_URI} !^/wp-json
    RewriteRule ^(.*)$ https://mysite.com.br/$1/ [L,R=301]
    

    Now I have the version 4.9.1 and all the forms are sending through ajax without any issue.

    I hope this could help others with the same problem.

    • This reply was modified 6 years, 11 months ago by webmoon.

    Thank you @webmoon, that has helped.

    Thanks for the help @webmoon. I have a question will this completely disable the wp-json path by adding an exception you mentioned as:

    `# Force trailing slash
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteCond %{REQUEST_URI} !^/wp-json
    RewriteRule ^(.*)$ https://mysite.com.br/$1/ [L,R=301]’

    • This reply was modified 6 years, 8 months ago by Yash Baldawa.
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Contact form 7 Error with SSL or wp-api or both.’ is closed to new replies.