Skip to content

Absolute URL being stripped from asset container configuration #11837

Closed
@ssyberg

Description

@ssyberg

Bug description

This is a request to undo #11371
(PR: #11372)

While this probably doesn't affect that many people, it completely broke our Nextjs / headless project because Nextjs processes relative paths differently from absolute paths. This will likely be true for other js frameworks and headless setups.

It's worth noting that 11371 is a bit of a confounding ticket, since they present a much better and more flexible solution in the ticket itself. Just set a relative path in the config and let the config continue to respect the url/path that is set:

Image

I'll also add this runs afoul of the laravel docs themselves: https://laravel.com/docs/12.x/filesystem#url-host-customization

How to reproduce

Set up a filesystem with an absolute path:

'public' => [
    'driver' => 'local',
    'root' => storage_path('app/public'),
    'url' => 'https://foo.bar.com/',
    'visibility' => 'public',
    'throw' => false,
],

You'll see under some circumstances this quietly gets stripped, namely if Statamic matches the asset host to the app host.

Logs

Environment

n/a

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions