-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hey !
I've been trying to use static caching on my dockerized statamic app and it seems like the current implementation always tries to hit localhost, meaning it's impossible to warm up the cache. It is worth noting that the caching works fine otherwise, hitting an uncached page will correctly cache the page for the next time.
When looking at the code for static:warm it seems that the entries always return absolute urls, meaning they all start with a slash and hit localhost.
However the Client used, which is just a GuzzleHttp\Client could accept a base_uri option to allow hitting a different host.
https://docs.guzzlephp.org/en/stable/quickstart.html#creating-a-client
In my case, I have two docker services, one php running php-fpm on port 9000 and an nginx service listening to port 80. The static:warm command runs on the php service and therefore get a 404 when trying to warm the cache.
laravel-1 | /eldenring/pegasus-glitch cURL error 7: Failed to connect to localhost port 80 after 0 ms: Could not connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost/eldenring/pegasus-glitch
laravel-1 | /eldenring/practice-tool cURL error 7: Failed to connect to localhost port 80 after 0 ms: Could not connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost/eldenring/practice-tool
In my case, I would need the command to hit http://web/eldenring instead of just /eldenring.
If we just add a base uri option to the warm command, the change should be pretty simple. If you guys think that would be an good addition, I can make a PR for it.
Thanks in advance.