Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWhy Claude Code keeps writing shell commands that fail on your Mac(20.09.2026 um 21:06 Uhr)
Sichere Programmierungllms.txt v2: What the Spec Says, and What 137,000 Domains Show(20.09.2026 um 21:17 Uhr)
Sicherheitslücken (CVE)NiceTryGPT: Less pattern matching. More actual hacking.(20.09.2026 um 21:19 Uhr)
IT Security VideoActivities BoF (kde2026)(20.09.2026 um 00:00 Uhr)
IT Security Toolsirdoc-app(20.09.2026 um 20:33 Uhr)
Sichere ProgrammierungWhy Claude Code keeps writing shell commands that fail on your Mac(20.09.2026 um 21:06 Uhr)
Sichere Programmierungllms.txt v2: What the Spec Says, and What 137,000 Domains Show(20.09.2026 um 21:17 Uhr)
Sicherheitslücken (CVE)NiceTryGPT: Less pattern matching. More actual hacking.(20.09.2026 um 21:19 Uhr)
IT Security VideoActivities BoF (kde2026)(20.09.2026 um 00:00 Uhr)
IT Security Toolsirdoc-app(20.09.2026 um 20:33 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Share Your Local Laravel App on a Public URL Without Mixed-Content Hell

Reagiere als Erste:r — dein Feedback zählt!

TL;DR

  • Exposing a local Laravel app over a public HTTPS tunnel breaks two ways: assets load from your localhost (teammate sees no CSS), and php artisan serve speaks plain HTTP behind the HTTPS proxy, so Livewire/Flux emit http:// URLs that the browser blocks as mixed content.
  • Fix the protocol with trustProxies(at: '*'), and fix the asset origin by pointing APP_URL + ASSET_URL at the tunnel URL.
  • I wrapped the whole thing in a composer share command that builds assets, opens the tunnel, rewrites .env, and restores it on exit. It's in cleaniquecoders/kickoff.

The problem

You want a teammate to click through your work-in-progress without deploying. The classic move: cloudflared tunnel (or ngrok) gives you a public https://... URL pointing at your local php artisan serve.

Then two things go wrong.

Symptom Cause Fix
Teammate sees raw HTML, no styling @vite points at the Vite dev server on your localhost (public/hot exists) Build assets, delete public/hot
Console: "mixed content blocked", random 419s Proxy is HTTPS but artisan serve is HTTP → request()->isSecure() is falsehttp:// asset/script URLs Trust the proxy + set ASSET_URL

Fix 1: trust the proxy

The tunnel terminates TLS and forwards plain HTTP to your app with an X-Forwarded-Proto: https header. Laravel ignores that header unless you tell it the proxy is trustworthy.

// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
    // Honour X-Forwarded-Proto from the tunnel so isSecure() is true
    // and Livewire/Flux emit https:// URLs (no mixed-content blocks).
    $middleware->trustProxies(at: '*');
    // ...
})

at: '*' trusts any proxy. That's fine for a throwaway tunnel on your own machine. In production, trust specific load-balancer IPs instead — a wildcard there lets a client spoof the forwarded headers.

Fix 2: point assets at the tunnel

Even with HTTPS detected, @vite and asset helpers resolve against APP_URL. If that's still http://localhost, the public visitor's browser tries to fetch your localhost. So rewrite both to the tunnel URL once it's up:

# wait for the tunnel to print its public https URL, then:
set_env APP_URL   "$PUBLIC_URL"
set_env ASSET_URL "$PUBLIC_URL"
php artisan config:clear

The one habit that saves you: back up .env first and restore it on exit, so a throwaway URL never gets left behind in your config.

ENV_BACKUP="$(mktemp)"; cp .env "$ENV_BACKUP"

cleanup() {
    rm -f public/hot
    cp "$ENV_BACKUP" .env   # restore APP_URL / ASSET_URL verbatim
    php artisan config:clear >/dev/null 2>&1 || true
}
trap cleanup EXIT
trap 'exit 130' INT TERM

One command

Wrapped together, composer share does the boring sequence every time: npm run buildrm public/hotphp artisan serve → open a Cloudflare (or ngrok) tunnel → scrape the public URL → set APP_URL/ASSET_URL → stream output until Ctrl+C → restore .env. Cloudflare's quick tunnel needs no account, so it's the default.

composer share
  │
  ├─ npm run build         (real assets, not the dev server)
  ├─ rm public/hot         (stop @vite pointing at localhost)
  ├─ php artisan serve     (:8000)
  ├─ cloudflared tunnel    -> https://xxxx.trycloudflare.com
  ├─ set APP_URL+ASSET_URL -> that url, config:clear
  └─ Ctrl+C -> restore .env, drop public/hot

Takeaway

The tunnel was never the hard part — the protocol mismatch was. Trust the forwarded proto, anchor your asset URL to the public host, and always restore .env. Bundle it into one command so "send me a link" takes five seconds, not five minutes of debugging blank CSS.

Code lives in cleaniquecoders/kickoff.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Share Your Local Laravel App on a Public URL Without Mixed-Content Hell

Thematisch verwandte Begriffe: Share, Your, Local, Laravel · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93956 | A flaw has been found in olivier-ls PHP-FTS up to 1.1.2. Affected by thi…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick