htmlgoogle-chromehttpreferrer

Why is my browser not sending any referrer?


I have an html page with the following code.

  <form method="POST" action="https://formspree.io/email">
    <input type="submit" value="SEND"/>
  </form>

My browser does not include the referrer header field in the http request when a user submits the form. Why wouldn't it ?


Solution

    1. You are testing your site by opening it in a browser as a static HTML file in your computer's filesystem. In this case its URL will not start with http:// or https://. This will not work, because browsers don't treat these pages as normal web resources and thus they do not automatically send the "Referer" header when you submit a form. Formspree requires that header to work. This can be solved if you just open your HTML files as a web resource from a local web server. If you're on Mac or Linux, just type python -m SimpleHTTPServer 8000 or your HTML files directory and visit http://localhost:8000 on your browser. If you're on Windows, try installing one of the following super simple web servers: Web server for Chrome, thttpd or Quickshare.

    2. You are using an old Safari version, Safari mobile or some other browser that is not recent Chrome, Firefox or Edge. In this case you could have been a victim of an old HSTS policy we had on Formspree that didn't allow sites to post content to non-https versions of Formspree. In this case please change your form's action= attribute to https://formspree.io/.