Skip to content

[5.x]: Incorrect CP console request URLs #15374

@bencroker

Description

@bencroker

What happened?

The commit 8e69802 addressed constructing URLs for console requests if the @web alias wasn’t explicitly defined. Should a similar change not also be applied to CP console requests to ensure that CP URLs are output as absolute URLs?

Steps to reproduce

  1. In a custom module, create a console command that outputs an entry’s CP edit URL.
die(\craft\helpers\UrlHelper::cpUrl());

Expected behavior

The output should be https://projectpath.ddev.site/admin.

Actual behavior

The output is /admin.

Tested in Craft 5 but this likely affects Craft 4 as well.

Craft CMS version

5.2.7

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

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