Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Vite::assetPath does not properly pass $secure flag to asset() fallback #55930

Copy link
Copy link
Open
@abdallaMansour

Description

@abdallaMansour
Issue body actions

Laravel Version

12

PHP Version

8.1.31

Database Driver & Version

No response

Description

In the file Illuminate\Foundation\Vite, the method assetPath() is defined as follows:

protected function assetPath($path, $secure = null)
{
    return ($this->assetPathResolver ?? asset(...))($path, $secure);
}

However, when the fallback asset(...) function is used, the $secure parameter is not passed in the actual call to assetPath(). For example

$this->assetPath("{$buildDirectory}/{$chunk['file']}")

The $secure argument is omitted in such cases, which causes asset URLs to be generated using HTTP even in HTTPS environments (e.g., in hosting platforms like (Railway).

This behavior may go unnoticed in local development, but it becomes critical in production environments where asset() needs to generate secure URLs (HTTPS), especially when mixed content warnings appear in browsers.

Steps To Reproduce

1 - Create new laravel 12 project with breeze
2 - Deploy the project in railway
3 - Run the application

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.