Spam protection
Every form is protected by a spam trap, a rate limit and a spam filter without any setup. You can also restrict a form to your own site and require a captcha. This page explains each one.
Last updated
The spam trap
Add a hidden checkbox named botcheck to the form. People never see it, so they leave it empty. Many bots fill in every field they find.
A submission with anything in botcheck is answered as if it worked, and nothing is kept or sent. The Install tab's snippets include the field. Keep it hidden, out of the tab order, and unchecked.
Allowed sites
Under Settings, "Allowed sites" takes one origin per line, such as https://example.com. With the list set, a request whose Origin header isn't on it is refused with 403. Browsers send that header on every cross-site form post and fetch.
With the list empty, any site may post to the form. Your access key is public, so set the list once your form is live. Changes apply within about a minute.
The list also decides which redirect addresses are honoured. See Where the browser goes afterwards.
Rate limits
Each visitor address can make a limited number of attempts on one form in a ten-minute window. Past that, the answer is 429 with "Too many submissions from your network. Please try again later." The limit is a person's pace, so real visitors don't meet it.
Your plan's monthly allowance is separate: when it is used up, submissions are refused with 429 until the next calendar month or a plan change.
Captcha
Most forms don't need one. If yours does, turn on "Require a captcha" under Settings and enter the site key and secret key from your own account with one of these services. The form then refuses every submission without a valid token.
| Service | Token field | What the visitor sees |
|---|---|---|
| Cloudflare Turnstile | cf-turnstile-response | A small widget that usually needs no interaction. |
| hCaptcha | h-captcha-response | A checkbox, sometimes followed by a challenge. |
| Google reCAPTCHA v2 (checkbox) | g-recaptcha-response | The "I'm not a robot" checkbox. |
| Google reCAPTCHA v3 | g-recaptcha-response | Nothing. Google scores each visitor from 0 to 1, and submissions under 0.5 are refused. |
- The site key is public and goes in your page. The secret key stays with FormRelay and is never shown again after you save it.
- With a widget, the service's script adds the token field to the form for you. With reCAPTCHA v3 your page asks for a token when the form is sent and adds it itself.
- A token works once. After each attempt made with
fetch, reset the widget so the next attempt gets a new token. - A missing or failed token is answered with 400 and "Please complete the captcha."
- Once you have saved the keys, the Install tab's snippets include the widget with your site key.
A form with a widget
This is the HTML form with Turnstile. hCaptcha and reCAPTCHA v2 work the same way with their own class name and script.
<form action="https://submit.formrelay.domodomu.com/submit" method="POST">
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
<input type="text" name="name" placeholder="Your name" required>
<input type="email" name="email" placeholder="you@example.com" required>
<textarea name="message" required></textarea>
<!-- Spam trap: people never see it, bots fill it in -->
<input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">
<div class="cf-turnstile" data-sitekey="YOUR_SITE_KEY"></div>
<button type="submit">Send</button>
</form>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>A form with reCAPTCHA v3
<form action="https://submit.formrelay.domodomu.com/submit" method="POST">
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
<input type="text" name="name" placeholder="Your name" required>
<input type="email" name="email" placeholder="you@example.com" required>
<textarea name="message" required></textarea>
<!-- Spam trap: people never see it, bots fill it in -->
<input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">
<input type="hidden" name="g-recaptcha-response">
<button type="submit">Send</button>
</form>
<script src="https://www.google.com/recaptcha/api.js?render=YOUR_SITE_KEY"></script>
<script>
// reCAPTCHA v3 shows nothing: ask for a token when a form is sent, then send it.
// Once per page is enough, however many of these forms it has.
document.querySelectorAll('form[action="https://submit.formrelay.domodomu.com/submit"]').forEach((form) => {
if (form.dataset.recaptcha) return;
form.dataset.recaptcha = 'on';
form.addEventListener('submit', (event) => {
event.preventDefault();
grecaptcha.ready(async () => {
form.elements['g-recaptcha-response'].value = await grecaptcha.execute('YOUR_SITE_KEY', { action: 'submit' });
form.submit();
});
});
});
</script>The spam filter
Accepted submissions are checked against a set of rules, for example a message stuffed with links. One that matches goes to the Spam folder and isn't emailed or sent to any integration. It still counts as a submission.
If the filter was wrong, open the message and choose "Not spam". It moves to the inbox and is delivered like any other submission.
Something missing or wrong? Email support@domodomu.com. New to FormRelay? See what it does or start free.