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

ridwanhoque's avatar

Images not showing on heroku

<img src="{{ asset('images/logo.png') }}" width="45" height="45"> Image is not displayed on the heroku app, please help

0 likes
14 replies
Sinnbeck's avatar

Check the image src in the html source. Is the url correct? Is the APP_URL correct in your .env file?

Sinnbeck's avatar

@ridwanhoque

Check the image src in the html source. Is the url correct?

Right click the missing image, and select "Inspect element"

ridwanhoque's avatar

@Sinnbeck is shows the image when click on right button open image in a new tab, but not showing on the page

Sinnbeck's avatar

@ridwanhoque F12 -> Console. Check the red errors.. Your image links are set to use http, while the site is https. Change your image links to https as well

example: https://pay-wm-pm.herokuapp.com/images/buy_me_a_coffee.png

Mixed Content: The page at 'https://pay-wm-pm.herokuapp.com/' was loaded over HTTPS, but requested an insecure image 'http://pay-wm-pm.herokuapp.com/images/buy_me_a_coffee.png'. This request has been blocked; the content must be served over HTTPS.
Sinnbeck's avatar

@ridwanhoque If you have ASSET_URL as well you need to also fix that

Or it can be cached.

php artisan optimize
martinbean's avatar

@ridwanhoque The issue you’ll be having is, your app is being server by Heroku’s load balancers. You’ll need to set up your trusted proxies so that it correctly detects the request is HTTPS and generates URLs as such:

<?php

namespace App\Http\Middleware;

use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
    protected $proxies = '*';

    protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB;
}

Please or to participate in this conversation.