Wrong domain name when generating an absolute URL with Url::fromRoute

Created on 17 March 2017, almost 8 years ago
Updated 14 July 2023, over 1 year ago

When trying to produce an absolute URL with the code below:

$url=\Drupal\Core\Url::fromRoute("entity.node.canonical", array('node' => $o->nid), array('absolute' => true));
$url_path=$url->toString();

i get URL like that:
http://8180.10.153.219.196.bacorh/node/34

the domain part of the URL seems to becoming from my $sites array

$sites = array(
        '8180.10.153.219.196.bacorh' => 'bacorh',
);

But i'm expecting to get an URL like:
http://10.153.219.196:8180/bacorh/node/34

πŸ’¬ Support request
Status

Closed: outdated

Version

9.5

Component
RoutingΒ  β†’

Last updated 3 days ago

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This was discussed at a bugsmash group triage meeting. This looks like it is site specific and thus a support request (according to larowlan).

    There has been no discussion here for 6 years so perhaps the problem has been resolved. If so, can you comment on what you did.

    If you are still experiencing this problem, are you able to provide steps to reproduce the issue β†’ (starting from "Install Drupal core")?

    Thanks

  • Status changed to Closed: outdated over 1 year ago
Production build 0.71.5 2024