Laravel 9 not loading Vite & Tailwind Assets on Production

Viewed 103

I am using Laravel 9 with tailwindcss and Vite on my development server to develop my project. On development server everything is working fine but when I uploaded my laravel project to production server running cpanel, none of my assets are loading properly. the error I'm getting :

Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure script 'http://0.0.0.0:5173/@vite/client'. This request has been blocked; the content must be served over HTTPS.

Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://0.0.0.0:5173/resources/css/app.css'. This request has been blocked; the content must be served over HTTPS.

I've tried to use URL::forceScheme('https'); in AppServiceProvider but to no avail.

Changed this line:

@vite(['resources/css/app.css', 'resources/js/app.js'])

in my guest.blade.php and app.blade.php file to this line:

<link href="{{ secure_asset('/resources/css/app.css') }}" rel="stylesheet">
<script src="{{ secure_asset('/resources/js/app.js') }}" defer></script>

but I'm getting this error:

    GET https://sarkercompanies.com/resources/resources/js/app.js 404 (Not Found) 12:28:20.818 
    GET https://sarkercompanies.com/resources/css/app.css net::ERR_ABORTED 404 (Not Found)

Please help as none of the solutions are working for me on production.

1 Answers
Related