Error 400 using formspree via ajax explained

  • by Amando Abreu
  • on 01/09/2017

So you decided to use formspree so you can submit forms with your static pages, but you’re getting a 400 Bad request error, and it may come with “could not find the “Referrer” header.”.

This simply means that formspree expects to receive a header called “referrer”, which webservers tend to include, however, if you’re testing this with static HTML, it’s not a webserver and contains no referrer header, so formspree complains. The same applied to a jekyll site running on my local environment with jekyll serve, but it worked fine when I uploaded the website to the server.

TL;DR;

Put those files on a webserver, if it fails on your local machine, try putting it on the live server.

About the author

Amando Abreu is a self-taught web developer, his first contact with programming was with C and Assembly for his robotics projects, and later moved onto web and mobile App Development. He is currently a Technical Project Manager at JobTender24 and lives in Düsseldorf, Germany.

Talking about himself in the third person makes him uncomfortable.