简体   繁体   English

DDEV和D8,用于内部请求的httpClient连接失败

[英]DDEV and D8, httpClient used for internal request fails to connect

I've a multisite installation of Drupal 8, the "main" website expose some REST webservices, locally i've some troubles on testing them, because there's no way for the various sites to see each other, when i try to do something like that我有一个 Drupal 8 的多站点安装,“主”网站公开了一些 REST 网络服务,在本地我在测试它们时遇到了一些麻烦,因为当我尝试做类似的事情时,各个站点无法看到彼此那

try {
  $response = $this->httpClient->get($this->baseUri . '/myendpoint', [
    'headers' => [
      'Accept' => 'application/json',
      'Content-type' => 'application/hal+json',
    ],
    'query' => [
      '_format' => 'json',
      'myparameters'  => 'value'
    ],
  ]);
  $results = $this->serializer->decode($response->getBody(), 'json');
}
catch (RequestException $e) {
  $this->logger->warning($e->getMessage());
}
return $results;

I always receive a timeout and there's no way i can make it work, i've my main website with the usual url project.ddev.site (and $this->baseUri is https://myproject.ddev.site ) and all the other websites are in the form subsite.ddev.local If i ssh in the project and run ping myproject.ddev.site i see 172.19.0.6 I don't understand why they cannot see each other...我总是收到超时,我无法让它工作,我的主要网站是通常的 url project.ddev.site (并且 $this->baseUri 是https://myproject.ddev.site )和所有其他网站的格式为 subsite.ddev.local 如果我在项目中使用 ssh 并运行 ping myproject.ddev.site 我看到 172.19.0.6 我不明白为什么他们看不到对方...

Just for other people who can have a similar problem: my issue was with xdebug i have it with the autoconnect, so when the request from the subsite to the main site was made, it get stuck somewhere (phpstorm didn't stop anywhere by the way) so it made the request time out.只是对于可能有类似问题的其他人:我的问题是 xdebug 我有它的自动连接,所以当从子站点向主站点发出请求时,它卡在某个地方(phpstorm 并没有在任何地方停止)方式)所以它使请求超时。

By disabling, or configuring only for the subdomain, and avoiding it to accept the external connenction from unconfigured servers (in phpstorm) it started working, still have to do some work as i need to debug "both sides" of the request, but in this way i can work with that...通过禁用或仅配置子域,并避免它接受来自未配置服务器的外部连接(在 phpstorm 中)它开始工作,仍然需要做一些工作,因为我需要调试请求的“双方”,但在这样我就可以使用它...

I've not thought before to try disabling xdebug because actually it didn't came into my mind...我以前没有想过尝试禁用 xdebug,因为实际上它并没有出现在我的脑海中......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM