The Fastly module fails with ping because the Drupal (89) request is not properly set up, only minimal bootstrap is done.
In the Fastly module, the following update needs to be done:
- $this->baseUrl = $requestStack->getCurrentRequest()->getHost();
+ $this->baseUrl = ($requestStack->getCurrentRequest() instanceof Request) ? $requestStack->getCurrentRequest()->getHost() : $_SERVER['HTTP_HOST'];
The alternative would be to set up the request ourselves. An example:
https://gist.github.com/jibran/e8d5f17aae6424934a77a16f2513420e
It can be easily tested within the ping code like this:
// Set up the request
...
$baseUrl = $requestStack->getCurrentRequest()->getHost();
The Fastly module fails with ping because the Drupal (89) request is not properly set up, only minimal bootstrap is done.
In the Fastly module, the following update needs to be done:
The alternative would be to set up the request ourselves. An example:
https://gist.github.com/jibran/e8d5f17aae6424934a77a16f2513420e
It can be easily tested within the ping code like this: