Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastly is problematic. #23

Open
ragnarkurmwunder opened this issue Mar 30, 2022 · 0 comments
Open

Fastly is problematic. #23

ragnarkurmwunder opened this issue Mar 30, 2022 · 0 comments

Comments

@ragnarkurmwunder
Copy link
Collaborator

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant