base_url used in routed Url assembler, but not in unrouted assembler

Created on 12 February 2024, about 1 year ago
Updated 26 February 2024, about 1 year ago

Problem/Motivation

When building routed Urls, you're able to set the option absolute to TRUE, and set the base_url option. When assembling the URL, this will result in the specified base URL being used in the URL.

But this option doesn't work for unrouted URLs. We should probably make this behavior consistent.

Steps to reproduce

This will work for a routed URL:
drush php:eval "echo \Drupal\Core\Url::fromUri('internal:/', ['absolute' => 1, 'base_url' => 'https://test.com'])->toString();"
will return https://test.com/

But it won't work for unrouted URLs:
drush php:eval "echo \Drupal\Core\Url::fromUri('internal:/404', ['absolute' => 1, 'base_url' => 'https://test.com'])->toString();"
will return https://your-local-domain/404

Proposed resolution

Adjust UnroutedUrlAssembler to take into account the base_url option.

Merge request link

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Base 

Last updated about 2 hours ago

Created by

🇸🇮Slovenia alecsmrekar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024