Summary
- Context
- The problem
- Expected behavior
- Actual behavior
- What I've tried
- Clues to help you to help me
- Final question
Context
I'm trying to locally test on Chromium hCaptcha, set on a form. My Laravel 8 site is running thanks to php artisan serve --host=myhost
.
The problem
Expected behavior
I open the form page, hCaptcha shows no error and actually shows the captcha.
Actual behavior
I go to the form page which contains the hCaptcha widget. (I don't click on the button "Send Form": I actually just go to the form page). The hCaptcha widget doesn't show the captcha but instead shows this error message:
Limited rate or network error. Please retry.
I open the Chromium console.
In the network tab: I can see this error request (its status =
CORS error
):https://hcaptcha.com/checksiteconfig?host=myhost&sitekey=XYZ&sc=1&swa=1
(withReferrer Policy: strict-origin-when-cross-origin
). ItsOPTIONS
POST
request's status is200
;In the console tab:
Access to XMLHttpRequest at 'https://hcaptcha.com/checksiteconfig?host=myhost&sitekey=XYZ&sc=1&swa=1' from origin 'https://newassets.hcaptcha.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
hcaptcha-checkbox.js:1 GET https://hcaptcha.com/checksiteconfig?host=myhost&sitekey=XYZ&sc=1&swa=1 net::ERR_FAILED
What I've tried
I've followed the hCaptcha documentation: https://docs.hcaptcha.com/#local-development. Note that I actually followed this doc which is about the vanilla hCaptcha (i.e.: I don't use any Laravel/Blade's implementation of hCaptcha). Thus:
- Ive typed
cat /etc/host
:
127.0.0.1 localhost 127.0.1.1 myhost
I run my PHP server that serves my Laravel site with:
php artisan serve --host=myhost
I open my Laravel site with this URL: http://myhost:8000/contact
Clues to help you to help me
I've seen that the hCaptcha docs speak about 127.0.0.1 as you can read it: 127.0.0.1 test.mydomain.com
. In my own Ubuntu etc/host
I see: 127.0.1.1 myhost
myhost(127.0.***1***.1).
myhostis actually the host I use so I actually use
127.0.1.1instead of
127.0.0.1`.
So: perhaps the hCaptcha client must be configured to use 127.0.1.1 instead of 127.0.0.1?
Final question
What could I do to reach the expected behavior from the actual one?