1

Trying to debug a form issue which is only happening on a live server (it works on our local environments).

The form makes a fetch request (using Javascript) to a route in routes.php which goes to a controller. I can see the data sent to the controller has the email address in the email field, but when it comes to the controller the field is empty.

I'm using:

$request = Craft::$app->getRequest();
$emailAddress = $request->getBodyParam('email');

$emailAddress is always empty on the live/staging/dev server.

The main difference between our local environments (we're using a mix of Mac, Windows, Herd, and DDEV) is that the servers are running REDDIS.

I've found similar issues with Craft 3 on here, but we're using Craft 5.1.2.

1 Answer 1

2

Discovered there was an NGINX config that was adding trailing slashes to URLs. Posting to the URL /api/controller-action was getting changed to /api/controller-action/ and emptying the POST data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.