Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Alteyss's avatar

Laravel 403 error (production) when doing ajax POST request only in HTTPS

Hi,

I've been through the web for about 3 hours to find a solution to my issue but can not find out...

I've uploaded my laravel application on a shared hosting, so the file architecture looks like:

  • _laravel
  • [n] folders
  • index.php
  • .htaccess

The .htaccess is the laravel default.

All my routes work fine when my website is hosted with HTTP (or in local) but when I switch it to HTTPS (applying from the OVH hosting panel) it breaks all my POST request (via ajax) to 403 error (Can't access... on this server).

Api route example: https://mywebsite.com/api/v1/login

If you have any suggestion, don't hesitate! Thanks.

0 likes
1 reply
Alteyss's avatar

I tried a lot of things, but I finally got the solution:

  • In my web hosting (OVH) panel, there was a firewall on the host, I disactivated it.
  • I regenerated the SSL certificate.
  • I destroyed cookies and session.

I don't know which one exactly made the trick but it saved my day!

Please or to participate in this conversation.