1

I have a problem with entity URLs in D8. All of them are absolute instead of relative, which causes various problems. For example,link URLs to edit content on /admin/content look like this:

http://example.local/node/693/edit?destination=http%3A//example.local/admin/content

instead of

/node/693/edit?destination=/admin/content

  • It's not theme-related issue
  • I checked various custom classes implementing OutboundRouteProcessorInterface and it seems, that none of them should affect this

What could be the cause, then?

EDIT: It's the same with all Drupal-generated links.

BTW. The issue can be seen by executing

use Drupal\Core\Link;
$link = Link::createFromRoute('This is a link', 'entity.node.canonical', ['node' => 1])->toString();
print_r($link);

It should result in relative URL, in my case it's absolute one.

  • maybe htaccess? or something with render cache. – user21641 Feb 13 '18 at 13:01
  • @IvanJaros Thanks, but it doesn't seem to be caused by server misconfiguration, because it's happening in different environments. Regarding render cache, do you have some related resource to share? Thanks – Miloš Kroulík Feb 13 '18 at 13:04
  • check the custom code base for use of setAbsolute() method on the Url object and of course, try one of the default themes. – user21641 Feb 13 '18 at 13:46
  • @IvanJaros Thanks, that method is used only in a completely unrelated way. Also, it's not a theme issue, as I described in the issue. – Miloš Kroulík Feb 13 '18 at 13:58
  • check settings.php for some weird logic or proxy settings. also try disabling js – user21641 Feb 13 '18 at 15:17
0

Sorry, it was caused by

$host = $_SERVER['HTTP_HOST'];
$config['language.negotiation']['url']['domains']['cs'] = $host;

in my settings.php file. Thanks all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.