Practical guide

405 Method Not Allowed when you submit a form

We posted the same form to GitHub Pages, Vercel, Cloudflare, Netlify, nginx, Apache and Python's server. Four said 405, one said 404, one pretended it worked.

The short answer. 405 Method Not Allowed means the server knows the address but will not take a POST there. On a form it nearly always means the action points at a static page or a host that only serves files, such as GitHub Pages, Vercel, Cloudflare or nginx, and nothing on the other end is set up to receive the data. Point the form's action at something that accepts posts: your own server code, a serverless function, or a form backend. Also check for a redirect, because a 301 or 302 can turn the POST into a GET and an API then answers 405.

Formgong

405 Method Not Allowed when you submit a form
405 Method Not Allowed when you submit a form

What 405 means

You press Send and get a bare page that says “405 Not Allowed”, or your script logs a 405. The HTTP standard defines it as a method “known by the origin server but not supported by the target resource”. The server found the address. It just does not accept the kind of request you made there, and for a form that request is almost always a POST.

So your fields, spam filter and email settings are not the problem, because nothing ever read the form. The fix is on the receiving side, where the form needs an address that is built to take a POST.

What seven hosts and servers answer

To see how common this is, we sent the same small form post to a static page on four popular hosts and three common web servers. The hosts were identified by their own response headers. Every page loaded fine with a normal GET.

The same form POST (name=Ann&message=Hello) to a static page on each host, 1 November 2026. A GET of the same address returned 200 everywhere.
Where the page livesStatus for the POSTWhat came back
GitHub Pages (pages.github.com)405Plain “405 Not Allowed” page
Vercel (a static file on vercel.com)405Empty body
Cloudflare (one of our own template demos)405Empty body
nginx 1.31.1, default config405“405 Not Allowed” page
Netlify (netlify.com, docs.netlify.com)404Netlify answers a POST it was not told to collect as “not found”
Python's built-in http.server501“Unsupported method”
Apache httpd 2.4.69, default config200Sends the page back and keeps nothing

Four of seven said 405, which is the honest answer: “this is a page, I do not take posts”. None of those four sent the Allow header that the standard says a 405 must include, so do not count on the response to tell you which methods would work.

The other three are worse, because they hide the problem. Netlify returns 404 for a POST to a page it was not told to collect, which looks like a broken link rather than a form issue. Python's development server says 501. And Apache, in its default setup, answered 200 and sent the page back. A form posting there looks like it worked, the visitor sees no error, and the message is gone. If your form “sends” but nothing ever arrives and the site runs on Apache with no script behind the form, this is a likely reason.

Why static hosts refuse posts

GitHub Pages, Vercel's static hosting, Cloudflare's static hosting and plain nginx serve files. When a visitor submits a form, the browser sends the fields to the address in action, and a file cannot do anything with them. There is no code there to save the message or email it to you, so the host refuses the request.

This is why a contact form copied from a tutorial often works on the author's PHP host and fails on yours: their action="contact.php" pointed at a script, while on a static host contact.php is just a file, or not there at all. Our guide to the HTML form action attribute explains what the browser does with that address.

Netlify is the one host with a built-in answer, and it is opt-in: its docs say to add a data-netlify="true" or a netlify attribute to the form tag, with form detection turned on. Without it you get the 404 from our test. If you use Netlify Forms and still see errors, see Netlify Forms not working.

The redirect that turns POST into GET

Sometimes the form does point at a working API, and you still get 405. Check whether the address redirects. If you post to http:// and the server sends you to https://, or you post to /api/contact and it redirects to /api/contact/, the browser follows the redirect. The HTTP standard notes that for a 301 or 302, a browser “MAY change the request method from POST to GET”, and browsers do. The API then receives a GET, which it does not accept, and answers 405.

The fix is to use the final address in your form, with https:// and the exact path. A server that has to redirect a POST should use 307 or 308, which keep the method. You can check both things from a terminal:

Two curl checks
# What does this address do with a form post?
curl -i -X POST -d 'name=test' https://your-site.example/contact

# Does the address redirect? A 301 or 302 here can turn the POST into a GET.
curl -sI https://your-site.example/contact | grep -iE '^(HTTP|location)'

Other ways to get a 405

A few more causes come up often. A script that calls fetch(url) with no options sends a GET, so an API that takes only POST answers 405; Formspree, for example, replies with “Please submit POST request.” (see our Formspree errors guide). In Next.js, a route handler that exports only GET answers 405 to a form post, which our Next.js contact form guide covers.

Give the form somewhere to post

You need one of three things at the end of the action: code you run yourself (PHP, Node, Python on a server that runs it), a serverless function on your host, or a form backend that takes the post and sends the message on. The first two mean writing and maintaining the code, plus the email sending; if you go that way with PHP, our guide to PHP mail() not sending email covers the part that usually breaks next.

The third needs no code. With Formgong you change the action to the endpoint, add your key, and the same static page on GitHub Pages, Vercel or Cloudflare starts delivering. Each message is emailed to you, kept in an inbox, and can go to Telegram or Google Sheets. Our guides for a GitHub Pages contact form and static website contact forms walk through it.

A form that a static host can serve
<form action="https://formgong.com/submit" method="POST">
  <input type="hidden" name="access_key" value="fk_your_access_key">
  <input type="text" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">
  <label>Name <input name="name" required></label>
  <label>Email <input type="email" name="email" required></label>
  <label>Message <textarea name="message" required></textarea></label>
  <button type="submit">Send</button>
</form>

Getting a 405 we did not cover?

If your host answers form posts in a way that is not in our table, send us the host and the status at support@formgong.com. We will test it and add a row.

What Formgong's free plan includes

  • Build the form or bring your own. The form builder takes the colours and fonts from your site's address, with no sign-up; ready form templates copy into your account; AI writes the fields from one sentence. Any hand-written HTML form works too.
  • Websites with the form already connected. 28 free website templates post to Formgong out of the box.
  • 250 submissions a month on unlimited forms. Spam does not count. Once a year, a busy month keeps delivering on credit until the 7th instead of stopping.
  • Everywhere you work. Email to up to 3 people at once, Telegram with Reply and Handled buttons, Google Sheets, Notion, and 3 signed webhooks for Slack, Discord, Zapier, Make or n8n.
  • Emails to your customers in your business's name. Formgong sends them under your business name and replies come back to you, with no email service of your own to set up: a review request to every lead, a reminder a visitor asked for, and review emails after an order with your logo and colours. People who agree can also go straight into your Mailchimp, Klaviyo, Brevo, MailerLite or Kit list. An automatic reply to each visitor is on Pro.
  • No captcha needed. A server-side spam filter, a honeypot, allowed domains and a block list; add your own Turnstile key if you want one.
  • Files and voice. Visitors can attach files, or record a voice message that arrives transcribed.
  • Made for AI-built sites. A hosted form page and a contact button; step-by-step guides for sites built with Lovable, Bolt, v0, Replit and Base44; an MCP server lets Cursor or Claude wire the form for you.
  • See what the form does. Analytics for views, starts, conversion and where each lead came from, and an alert when a form goes quiet.
  • One account for the rest. Customer reviews and an AI help chat that answers visitors from your own pages, with every message in one inbox. Data is stored in the EU.

Frequently asked questions

What does 405 Method Not Allowed mean on a form?

The server found the address but does not accept a POST there. Usually the form's action points at a static page or file, so nothing is set up to receive the data.

Why does my form get 405 on GitHub Pages or Vercel?

Both serve static files, and a file cannot process a form post, so they answer 405. Point the action at a form backend or a serverless function instead.

Why do I get 405 when the API accepts POST?

Check for a redirect. A 301 or 302, for example from http to https or to a trailing slash, can turn the POST into a GET, which the API refuses. Use the final URL.

My form shows no error but nothing arrives. Could it be the same problem?

Yes. In our test Apache's default setup answered a form post with 200 and kept nothing, and Netlify answered 404. Check where the action points and what answers there.

Sources and documentation

Official references for this guide: RFC 9110, HTTP Semantics: 405 Method Not Allowed, RFC 9110: 301 Moved Permanently, Netlify Docs: Forms setup, MDN: 405 Method Not Allowed. Add a form to an HTML site, where data is stored.

Rate this guide

Your rating

We read every rating. A comment appears here only after we approve it.

← Back to the blog