Recently I ran into a problem, that was pretty annoying, and not so clear how to fix.

The story goes, that there is a WordPress site, with Contact Form 7, and Super Cache with static file cache, on a server with nginx 0.7 as a reverse proxy infront of an Apache 2.2.

When, I was testing the page, everything was fine – as usual – , but when my client were testing it it wasn’t working at all. The representative said, they filled out the contact form, and after hitting the submit, the arrows just spin, and spin, and nothing had happened. I was a bit nervous, that I could not debug such problem. And had absolutely no clue about the source of the problem.

It was clear, that Contact Form 7, is an ultimate solution, and very, very popular, so it could not be it’s fault.

Then I logged out, and tried out myself this way. First it gone great, but for the second try… the arrows, after the submit were just spinning… Wow, I can reproduce the error! :D

My Firebug was active, so I could see, that after the HTTP POST an nginx error came back saying HTTP 405 Method not allowed.

Gosh, what is this?
Where is this coming from?

Then I started to dig into this topic, and googling a bit. I stumbeled into this thread in the offical nginx forum.

So, nginx 0.7 could not accept POST on a static file. Sounds weird. But okay, that’s the case.
But what is the solution?

While I was logged in to the site it showed me a non-cached version of the contact form page, and everything worked well. But, if I logged out, the page was cached. And since this bug, the form will produce this kind of error.

One solution can be, upgrading nginx to 0.8 branch, that may solved the issue. But it impossible if you are not the administrator of the server, just a user, or a client on a shared host.

Let’s think a little bit more. If a static file accepts the POST, does it really gets to wordpress?
I guess, it won’t (I havn’t tried it out, but seems logical). So, we have to figure out something wiser.

The point is, if I want Contact Form 7 to work well, I cannot cache this page.
In Super Cache options there is a section “Accepted Filenames & Rejected URIs“, so I added the slug of my contact page, to this box.

No Comment.

Add Your Comment