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

Blitz caches HTML with urls to "generate-transform actions" #125

Closed
ostark opened this issue Aug 29, 2019 · 5 comments

Comments

@ostark
Copy link

commented Aug 29, 2019

Hi Ben

One of our (fortrabbit) clients reported traffic spikes (10K instead of 100K requests per hour) recently. We noticed massive requests to urls like /index.php?p=actions/assets/generate-transform&transformId={transformId}.

When having a look at the html responses, we noticed that Blitz was the reason, since the URLs were cached.

The Craft {% cache %} prevents it actively
https://github.com/craftcms/cms/blob/3.1/src/services/TemplateCaches.php#L272

Is this implemented in Blitz as well? Is there a setting?
Or should the "template developer" take care of it?

Cheers,
Oli

@ostark ostark changed the title Blitz caches HTML to generate-transform actions Blitz caches HTML with urls to "generate-transform actions" Aug 29, 2019
@putyourlightson

This comment has been minimized.

Copy link
Owner

commented Aug 29, 2019

Hi Oliver, as you correctly noticed, Blitz caches pages even if they contain URLs with the assets/generate-transform action. One workaround could be to enable the generateTransformsBeforePageLoad config setting, but it would probably make sense to prevent Blitz from caching such pages by default. Do you see any possible downsides to this?

@ostark

This comment has been minimized.

Copy link
Author

commented Aug 29, 2019

I'm not a fan of generateTransformsBeforePageLoad. Async calls make much more sense.
I'd suggest preventing caching if assets/generate-transform is in the response body, like Craft does.

@putyourlightson

This comment has been minimized.

Copy link
Owner

commented Aug 29, 2019

Agreed, will look into adding this in the next release. Thanks for reporting it!

@putyourlightson

This comment has been minimized.

Copy link
Owner

commented Aug 30, 2019

One issue I can see is that warming the cache will not be as predictable, as Blitz currently uses Guzzle to make calls to the pages that need warming, so no AJAX requests. I'll need to consider either a workaround or maybe make this an opt-in config setting.

@putyourlightson

This comment has been minimized.

Copy link
Owner

commented Sep 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.