Error when using modal and drawers in production

I’m using laravel + quasar + mysql to create an application. While it is running on localhost everything works normally, but when I go up to production with ssl all modals and drawers have the following error:

cess to XMLHttpRequest at ‘https://ctechapi.jaborandi.sp.gov.br/api/agendacinema/view/150/’ from origin ‘https://sistema.ctech.digital’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: Redirect is not allowed for a preflight request.

I’ve tried changing the headers, allowing in .htacess, in laravel’s CORS config and nothing works. Possibly an error related to SSL or CROSSDOMAIN, as the API and the frontend are on different servers.

Does anyone have any other solutions?

LOCALHOST

PRODUCTION

I found a solution.

This error occours because laravel is redirecting the urls that ends with / to the same without /
Like:
https://site.com/api/view/12/ ----> https://site.com/api/view/12

What u need to do is open .htacess on public laravel’s folder and remove this lines:


    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

1 Like

I faced same issue. your suggestion is working. Many thanks for the info share the community forum

          .....................Thanks.........................