Filament favicon is not embedded via https

Hello everyone. I use the directive ->favicon(asset('/images/favicon.png')) in my panel. When I call my panel in the local environment, the favicon is provided and included as expected. On my prod server (on fly.io), however, the favicon is strangely included via Http, although the entire app is provided via HTTPS. All other assets (CSS, JS, laravel and filament) are included relative or via absolute path with HTTPS. What is the reason for this and how can I change it? My browser understandably does not want to display a favicon integrated via a different protocol. I have already tested re-build and filament upgrade. If I call asset('/images/favicon.png') once on my fly.io instance via SSH in artisan tinker, I also get the path including HTTPS. If I see it correctly, the behavior occurred after the introduction of multi-tenancy. As a result, I had to reconfigure some routes. Could it be somehow related to this? And how can I debug or fix this correctly? My routing configuration currently looks like this:
Route::get('{tenant}/image/{model}/{field}/{id}', [App\Http\Controllers\ImageController::class, 'show'])->name('image');
Route::redirect('{tenant}/aktuelle-probe', '/{tenant}/proben/' . (App\Models\Probe::current()?->id));
Route::get('{tenant}/image/{model}/{field}/{id}', [App\Http\Controllers\ImageController::class, 'show'])->name('image');
Route::redirect('{tenant}/aktuelle-probe', '/{tenant}/proben/' . (App\Models\Probe::current()?->id));
Many thanks in advance for your help! Johannes Nazarov
Solution:
Try modifying the ASSET_URL env var. If that doesn't work try adding a force HTTPS in a service provider depending on your apps environment. https://stackoverflow.com/a/51819095
Stack Overflow
How to force Laravel Project to use HTTPS for all routes?
I am working on a project that requires a secure connection. I can set the route, uri, asset to use 'https' via: Route::get('order/details/{id}', ['uses' => 'OrderController@details', 'as' =&g...
Jump to solution
4 Replies
johny7
johny74w ago
No one there who can help me? If I have found out correctly, the layout for this is under vendor\filament\filament\resources\views\components\layout\base.blade.php. The first lines (up to the integration of the favicon) look like this:
@props([
'livewire' => null,
])

<!DOCTYPE html>
<html
lang="{{ str_replace(‘_’, ‘-’, app()->getLocale()) }}”
dir="{{ __(‘filament-panels::layout.direction’) ?? 'ltr' }}”
@class([
'fi min-h-screen',
'dark' => filament()->hasDarkModeForced(),
])
>
<head>
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::HEAD_START, scopes: $livewire->getRenderHookScopes()) }}

<meta charset=“utf-8” />
<meta name=“csrf-token” content=“{{ csrf_token() }}” />
<meta name=“viewport” content=“width=device-width, initial-scale=1” />

@if ($favicon = filament()->getFavicon())
<link rel=“icon” href=“{{ $favicon }}” />
@endif
@props([
'livewire' => null,
])

<!DOCTYPE html>
<html
lang="{{ str_replace(‘_’, ‘-’, app()->getLocale()) }}”
dir="{{ __(‘filament-panels::layout.direction’) ?? 'ltr' }}”
@class([
'fi min-h-screen',
'dark' => filament()->hasDarkModeForced(),
])
>
<head>
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::HEAD_START, scopes: $livewire->getRenderHookScopes()) }}

<meta charset=“utf-8” />
<meta name=“csrf-token” content=“{{ csrf_token() }}” />
<meta name=“viewport” content=“width=device-width, initial-scale=1” />

@if ($favicon = filament()->getFavicon())
<link rel=“icon” href=“{{ $favicon }}” />
@endif
Does anyone know how I can find out which controller is used to call up this layout?
awcodes
awcodes4w ago
Everything in panels uses that layout. I guess the more appropriate approach is why are you overriding paths?
Solution
Tonkawuck
Tonkawuck4w ago
Try modifying the ASSET_URL env var. If that doesn't work try adding a force HTTPS in a service provider depending on your apps environment. https://stackoverflow.com/a/51819095
Stack Overflow
How to force Laravel Project to use HTTPS for all routes?
I am working on a project that requires a secure connection. I can set the route, uri, asset to use 'https' via: Route::get('order/details/{id}', ['uses' => 'OrderController@details', 'as' =&g...
johny7
johny74w ago
I actually didn't realize that I was overwriting any paths. Where and how could that be? Thank you, after I set ASSET_URL, the favicon is accessible. Also Facades\URL::forceScheme('https') had no effect before.
Want results from more Discord servers?
Add your server