Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
58 posts Page 6 of 6
Previous 1, 2, 3, 4, 5, 6 Next
Again, the cache problem ...
The plug-in is very useful, but after every resizing and pressing of Save you have to Ctrl+F5 (Windows)
I see the problem is in caching images.
At the root of my site I have
Code: Select all
<IfModule mod_expires.c>
# Enable expirations
  ExpiresActive On
# Default directive
  ExpiresDefault "access plus 1 month"
# Images
  ExpiresByType image/svg "access plus 6 month"
  ExpiresByType image/gif "access plus 2 month"
  ExpiresByType image/png "access plus 2 month"
  ExpiresByType image/jpg "access plus 2 month"
  ExpiresByType image/jpeg "access plus 2 month"
</IfModule>

Of course, if this code is gone, the plug-in will work fine, but I can not remove it because the whole site will suffer.
I have tried two things - both of them are unsuccessful
1
Separate .htaccess file in the Couch folder
Code: Select all
<IfModule mod_expires.c>
# Enable expirations
  ExpiresActive On
# Default directive
  ExpiresDefault "access plus 1 month"
# Images
  ExpiresByType image/svg "access plus 6 month"
  ExpiresByType image/gif "access plus 2 month"
  ExpiresByType image/png "access plus 2 month"
  ExpiresByType image/jpg "access plus 2 seconds"
  ExpiresByType image/jpeg "access plus 2 seconds"
</IfModule>

note - access plus 2 =seconds

2
Code: Select all
<IfModule mod_headers.c>
   Header set Cache-Control "no-cache, no-store, must-revalidate"
   Header set Pragma "no-cache"
   Header set Expires 0
</IfModule>

The second trick was recommended by the hosting company
I do not know what else to do, there must be a way to stop caching when working with the plug-in.
I'm asking for help
https://stackoverflow.com/questions/388 ... onditional
I don't use this addon and don't have a solution, but this topic seems to be useful if you can find some pattern in the url to base condition upon. If you get it working after experiments, kindly post final solution here.
@orbital, the correct way *is* to disable any kind of caching within the admin folder ('couch' by default).
Since we can have a separate .htaccess for the admin-panel, the second method suggested by your host is perfect for this.

For what it's worth, following is the configuration I use for most of my sites -

.htaccess in the site's root:
Code: Select all
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType text/html "access plus 0 seconds"
# Data
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Feed
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresDefault "access plus 1 month"
</IfModule>
## EXPIRES CACHING ##

.htaccess in 'couch' folder::
Code: Select all
<IfModule mod_expires.c>
# disable caching forthis directory mod_expires for this directory
ExpiresActive off
</IfModule>

Never had any problem whatsoever.

Hope it helps.
Hi, thank you for the answers
KK,
1 - I put the two code portions respectively in .htaccess root & .htaccess Couch
2 - I deleted the whole cache of Chrom
3 - Only now did I enter an admin panel

Before I resizes the image in cache:
http://my_site.com/upload/image/galery/ ... 00x315.jpg
After resize the images in cache:
http://my_site.com/upload/image/galery/ ... 0145878816
http://my_site.com/upload/image/galery/ ... 8901780434

http://my_site.com/upload/image/galery/ ... 0145878816
http://my_site.com/upload/image/galery/ ... 8901780434

These images are not in the admin folder!
I think the problem is some other - we have to stop caching for the directory of these images.
I put this code in a upload folder
Code: Select all
<IfModule mod_expires.c>
# disable caching forthis directory mod_expires for this directory
ExpiresActive off
</IfModule>

Now everything is fine - you do not have to press a Ctel+F5 after each resizing.
However, this solution is wrong!
Now there is a problem with Google PageSpeed Insights - he reports a gross error - all images on the site are not cached at all!
I brought things back to their original state.
I think there is no solution to the problem with this plugin ...
The addon automatically adds to all thumbnails (while showing them in the admin-panel) a 'rand' querystring param, as seen below -
Code: Select all
http://my_site.com/upload/image/galery/image-600x315.jpg?rand=0.9150860145878816
http://my_site.com/upload/image/galery/image-600x315.jpg?rand=0.42827038901780434

That should be sufficient to bypass any kind of caching as far as admin-panel is concerned.

I am surprised you are reporting the random values being appended but the stale image being shown.

If your site is online, PM me the access creds and I'll take a look at the issue.

Thanks.
Hi KK,
the site is online, but the same behavior is noticeable on all my sites where this plugin is used.
I will send the login details by email.
Thank you
Hi,
The cache issue is completely fixed!
I tested the version of this plugin from github
Let me thank you KK
Thank you @orbital for testing the fix and sharing your observation.
Previous 1, 2, 3, 4, 5, 6 Next
58 posts Page 6 of 6

Who is online

In total there are 3 users online :: 1 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: Google [Bot] and 2 guests

cron