Skip to content

Fix flag URLs when the application is served from a subdirectory - #2794

Merged
calebporzio merged 4 commits into
livewire:mainfrom
ghabriel25:fix/flag-url-1
Sep 3, 2026
Merged

Fix flag URLs when the application is served from a subdirectory#2794
calebporzio merged 4 commits into
livewire:mainfrom
ghabriel25:fix/flag-url-1

Conversation

@ghabriel25

@ghabriel25 ghabriel25 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Problem

AssetManager::flagUrl() (used by the <flux:flag> component) generated a root-relative path via:

route('__flux.flag', ['country' => $country], false)

When the Laravel app lives under a path prefix / subdirectory, the browser resolves /flux/flags/XX against the domain root instead of the application base. This results in 404s for flag SVGs.

Reported in #2793.
Related PR: #2183

Solution

Wrap the relative route result with Laravel’s url() helper so the generated URL respects the application’s base path / APP_URL /:

return url(route('__flux.flag', ['country' => $country], false).'?id='.$hash);

Fixes: #2793

@ghabriel25
ghabriel25 marked this pull request as ready for review September 2, 2026 02:36
@ghabriel25
ghabriel25 marked this pull request as draft September 2, 2026 13:50
@ghabriel25
ghabriel25 marked this pull request as ready for review September 2, 2026 13:57
@calebporzio
calebporzio merged commit f566855 into livewire:main Sep 3, 2026
1 check passed
@ghabriel25
ghabriel25 deleted the fix/flag-url-1 branch September 3, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag component ignores app prefix by default

2 participants