- Issue created by @t.maquin
- 🇧🇾Belarus savage1974
Hi, t.maquin
Try to warm you caches with this command:
vendor/bin/drush --uri=https://your.domain warmer:enqueue cdn vendor/bin/drush queue-run warmer
When you use relative URLs in the CDN Warmer and attempt to warm them with the following commands:
vendor/bin/drush warmer:enqueue cdn
vendor/bin/drush queue-run warmer
If your server does not have your website domain set in its environment variables, you'll get an absolute URL like this: https://default/my/relative/url.
This URL is returned by the resolveUri function, which uses Url::fromUri and Url::fromUserInput to convert relative URLs to absolute ones.
In my case, we cannot or do not want to set an environment variable on our server because it hosts multiple websites.
This issue does not occur in a website context (if you warm your CDN from the back office interfaces). In this scenario, the Url class can retrieve the actual website scheme and host because it operates within an HTTP request context.
For now, I’ve just split my configurations and directly set the absolute URLs in the CDN configuration, since I only have around 20 URLs to warm.
Should this module have the actual website base url in its configuration to avoid this problem in a drush context ?
We could simply change the resolveUri function to concatenate relative urls with the base url store in the module configuraiton.
Let me now what you think about this issue and if there is another way to deal with it.
Active
2.0
Code
Hi, t.maquin
Try to warm you caches with this command:
vendor/bin/drush --uri=https://your.domain warmer:enqueue cdn
vendor/bin/drush queue-run warmer