Hi,

When setting the Solr host to "localhost" (default setting), the URL for the Solr server gets overridden with the base URL of the Drupal installation like so http://drupal.localhost:8983/solr/ instead of the intended and correct http://localhost:8983/solr/.

I'm not sure whether this is some misconfiguration on my side so I'm marking this as a support request for the time being.

Best regards,
Frank

Comments

Frank Ralf’s picture

I think I found the culprit in includes/service.inc. The getServerLink() function shortcircuits to the server URI if host is set to "localhost":

/**
 * Returns a link to the Solr server, if the necessary options are set.
 */
  public function getServerLink() {
    if (!$this->options) {
      return '';
    }
    $host = $this->options['host'];
    if ($host == 'localhost' && !empty($_SERVER['SERVER_NAME'])) {
      $host = $_SERVER['SERVER_NAME'];
    }
    $url = $this->options['scheme'] . '://' . $host . ':' . $this->options['port'] . $this->options['path'];
    return l($url, $url);
  }

Frank

drunken monkey’s picture

Status: Active » Fixed

That's just for presentational purposes, since displaying "localhost" there won't lead to a correct link in most cases. Internally, "localhost" will be used, so this shouldn't cause any problems (except, it seems, some confusion – had this issue reported a couple of times now).

Frank Ralf’s picture

Thanks for the explanation.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

codium’s picture

Please remove it. It's misleading.

donquixote’s picture

Yes, this is definitely confusing. I spent some time trying to figure out what is going wrong.

displaying "localhost" there won't lead to a correct link in most cases.

In my case, the modified link does not lead anywhere either.
But at least the localhost link is technically correct. So that one shall be displayed, imo.