5

I deploy laravel project on Heroku.

but bootstrap styles a missing.

bootstrap is in public dir

in browser network showing this

enter image description here Showing status blocked

2

4 Answers 4

9

Go to app >> Providers >> AppServiceProvider.php

Import this:

use \Illuminate\Support\Facades\URL;

Under the boot method, paste the code below

if ($this->app->environment('production')) {
    URL::forceScheme('https');
}

Note: The code above checks whether you are in development mode or production to render your assets.

Sign up to request clarification or add additional context in comments.

Comments

6

You are looking for secure_asset

Generate a URL for an asset using HTTPS:

In your code:

<link rel="stylesheet" href="{{ secure_asset('css/AdminLTE.min.css') }}">

1 Comment

0

Try the following.

@production
    <link rel="stylesheet" href="{{ secure_asset('css/AdminLTE.min.css') }}">
@endproduction

Comments

0

Just Add the Following lines in AppServiceProvide.php inside boot function

if (env('APP_ENV') != 'local') {
            URL::forceScheme('https');
        } 

This will automatically detect your current host and convert simple HTTP request to HTTPS. Hopefully it will work for you.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.