Mixed content means your page loads over HTTPS, but some of its images, stylesheets or scripts still load over HTTP, so the browser blocks or warns about them. The fix is almost always the same short list: set APP_URL to https, tell Laravel to trust your proxy, and force a proper HTTPS redirect.
It feels like a certificate problem, and most people start there. In our experience it rarely is. The certificate is usually fine. The app simply does not know the visitor arrived over HTTPS, so it keeps building http:// links for its own assets. Once Laravel knows the truth, the warnings go away.
What is mixed content, and why does the browser block it?
When a page is served over HTTPS, the browser expects everything on that page to be encrypted too. An image or script loaded over plain HTTP breaks that promise. The browser calls it mixed content: passive content like images may load with a warning, while active content like scripts and stylesheets is usually blocked outright.
That is why a Laravel site can look half-broken after you install SSL. The page itself is secure, but the CSS never loads, so the layout collapses. Or the JavaScript never runs, so buttons do nothing. The page is not broken. Its assets are just being refused at the door.
How do I know mixed content is the problem?
Open the page in your browser, press F12, and look at the Console tab. Mixed content errors are explicit: the browser names the blocked URL and tells you it was loaded over HTTP from an HTTPS page. If you see that message, you have your answer. If you see a different error, such as a certificate warning or a 404, you have a different problem.
Also check the address bar. A padlock with a warning, or a "Not Secure" label on some pages only, usually points to mixed content on those pages.
What should APP_URL and ASSET_URL actually say?
Start in your .env file. APP_URL must use https and must match the domain visitors actually use, with no trailing slash:
APP_URL=https://yourdomain.com
This one line is the most common fix we see. Many installs are set up with http:// first, and nobody changes it after SSL is added. Laravel uses APP_URL when it builds absolute URLs, so a wrong value here poisons links across the whole site.
After changing it, clear the configuration cache, or your edit will sit there doing nothing: run php artisan config:clear, then php artisan config:cache, from your project root. If you skip this step, the old cached value keeps serving http:// links, and you will spend an hour chasing a problem you already fixed.
ASSET_URL is a different setting and usually you should leave it alone. Only set it if your assets genuinely live on another domain or a CDN. If you are unsure, leave ASSET_URL unset.
How do I force HTTPS behind a proxy or Cloudflare?
This is the step most people miss, and it is the one that matters on real hosting. On a VPS or behind Cloudflare, the visitor connects to the proxy over HTTPS, but the proxy talks to your server over plain HTTP. Laravel sees an HTTP request and builds http:// asset URLs, even though the visitor is on HTTPS.
The fix is to tell Laravel to trust the proxy headers. In modern Laravel, the TrustProxies middleware handles this: your application should trust the proxies in front of it, so that the X-Forwarded-Proto header tells Laravel the visitor's real scheme. Check that the trusted proxies configuration includes your proxy or load balancer, and that the headers it trusts include X-Forwarded-Proto.
Do not try to fix this by hard-coding https:// into every blade template. Fix the scheme detection once, and every URL the app builds will be right.
| Symptom | Likely cause | Fix |
|---|---|---|
| All pages warn, CSS missing | APP_URL still http:// | Set APP_URL to https:// and clear config cache |
| Works without Cloudflare, breaks with it | Proxy headers not trusted | Configure trusted proxies to honour X-Forwarded-Proto |
| Only one page warns | Hard-coded http:// link in content | Change that link to https:// or a relative URL |
| HTTPS works, HTTP still serves pages | No redirect in place | Add a server-level redirect from HTTP to HTTPS |
| Fix applied but nothing changed | Stale config cache | Run php artisan config:clear, then cache again |
What about the .htaccess redirect — is it enough?
A redirect is necessary, but it is not the whole fix. Adding a redirect in .htaccess or your Nginx configuration makes sure visitors who type http:// end up on https://. That is good practice, and every HTTPS site should have it. But a redirect only changes the page URL. It does not change the asset URLs Laravel generates inside the page.
Think of it this way: the redirect gets the visitor through the right door, and APP_URL plus trusted proxies make sure everything inside the room is labelled correctly. You need both. Test it after adding it, and clear your browser cache before testing, because browsers remember redirects aggressively.
How do I find the last stubborn HTTP links?
After the configuration is right, a few hard-coded links usually remain. The browser console lists them one by one, so work through that list rather than guessing. The usual hiding places are images pasted into page content, a font loaded from an old URL, a third-party script, or an embed from another site.
For your own content, change http:// links to https://, or better, to relative URLs that inherit the page's scheme. For third-party embeds, check whether the provider offers an HTTPS version. Almost all of them do now. If a provider genuinely has no HTTPS version, replace it. Also check your database content: pages written before SSL was added may store http:// image links that no config change will fix, so search and replace in the affected tables, with a backup taken first.
A quick checklist before you call it fixed
Run through this list in order, and do not skip the cache step. It is the step that causes most repeat visits to this problem.
- APP_URL in .env uses https:// and matches the live domain
- Trusted proxies configured so Laravel sees the visitor's real scheme
- HTTP to HTTPS redirect in place at the server level
- php artisan config:clear run, then config cached again
- Browser console shows no mixed content errors on the homepage and one inner page
- Hard-coded http:// links in content replaced or removed
- Site tested in a fresh private window, not just a cached tab
If you are buying ready-made Laravel code rather than building your own, this checklist still applies after installation. Every product in the full catalogue on codelist ships with an installation guide, and the same APP_URL and proxy steps come up during setup. If you get stuck on the licence side of a purchase, the licence terms explain what each licence covers, and the frequently asked questions cover the common buying questions. Do not leave a mixed content warning in place because the site "mostly works": the fix takes less than an hour, so do it properly and move on.
