putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
147 stars 35 forks source link

Purge requests for `__home__` instead of `/` #673

Closed kbergha closed 2 weeks ago

kbergha commented 2 weeks ago

Support Request

Hi.

I'm trying to use Blitz for purging with Cloudfront. When saving the home page entry I'm getting purge requests for /__home__/ instead of the expected /

PHP: 8.3.8 Craft: 5.0.3 Blitz: 5.3.1 Blitz CloudFront Purger: 5.0.0

Blitz setup

As of right now, I'm trying to use Blitz as a purger only due to the issue I have with the local generator (#672)

2024-06-17 16 07 18 15139e0006e3

Purger setup

2024-06-17 15 50 32 craft cic oslo kommune localhost 347e61c8a351

Invalidation request from AWS console

2024-06-17 14 51 35 us-east-1 console aws amazon com fac23373542b

Section set up

You can see that this section is selected as the home page:

2024-06-17 15 46 34 6aba47b399dd

A test query from the database

I'm guessing this is where /__home__/ comes from.

mysql> select id, title, uri from elements_sites where slug = 'forsiden' order by id desc limit 1\G;
*************************** 1. row ***************************
   id: 64
title: Forsiden
  uri: __home__
1 row in set (0.00 sec)

Summary

Why do I get /__home__/ instead of the expected / in the invalidation / purge request in AWS ? This is probably related to the change done in https://github.com/putyourlightson/craft-blitz/issues/538 ?

I didn't open this issue in the CloudFront purger repo, because I don't think it's a CloudFront specific issue. It's probably an issue with SiteUriHelper and/or SiteUriModel in the base plugin.

Plugin Version

5.3.1

bencroker commented 2 weeks ago

Thanks for reporting this. The addition in https://github.com/putyourlightson/craft-blitz/commit/385ab48749efdf5ef0dd63cd2ae33f69834b6e11 should fix this. Can you please test and let me know if it resolves the issue for you?

kbergha commented 2 weeks ago

Thanks.

Using dev-develop, it works as expected now. I also had to update Craft to 5.2.1 at the same time.

2024-06-18 09 09 53 us-east-1 console aws amazon com 1c6613a7e1d5

bencroker commented 2 weeks ago

Great! Released in 4.18.2.