top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Web:How to enable the image caching when images are coming from thirdparty?

+2 votes
332 views

Now its a real problem which we are facing at QueryHome, we have images which were present on our server and caching was working now we have moved these images to the CDN and caching is not working.

We have following .htaccess for enabling the caching -

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
<FilesMatch "\.(ico|jpg|jpeg|png|gif)$">
ExpiresDefault "access plus 2 weeks"
</FilesMatch>
<FilesMatch "\.(js|css|swf)$">
ExpiresDefault "access plus 2 weeks"
</FilesMatch>
</IfModule>
## EXPIRES CACHING ##
posted Apr 24, 2014 by Salil Agrawal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I found the solution and thought to share so that it can be beneficial for all -
I was assuming that setting up the correct .htaccess in my website would do the trick but I was wrong as these are coming from third part so caching enabling has to be done at those not on my site.

Since I was using Google app engine and the trick is just open the app.yaml file for your application and add the following line (default_expiration: "4d 5h") something like

application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: true

default_expiration: "4d 5h"

handlers:

answer Apr 25, 2014 by Salil Agrawal
Similar Questions
+3 votes

I went through this Discussion:

http://stackoverflow.com/questions/7087036/fetching-images-from-server-while-drawing-the-cell

I have a web server server-1.example.com. There is a JSON-Server running on another server server-2.example.com. What I have to achieve is to fetch a list of URLs (in form of JSON response) from server-2 and loop through the urls and fetch them from the server-1. In the meantime i have to animate these images on the browser by Fading the images one after the another.

The algorithm is something like this:-

START:
   FETCH the URLs from server-1 and store them in a cache C
   Loop until C.length
      Fetch first K images by forking a thread.
      animate k images
 END

How can I optimize K? Is my approach right?

...