Howto cache images on IIS7 - caching

I have a web application that get a big amount of images via a server script proxy
which re-sizes them to specific thumbnails size.
so the url of a given image would be something like:
myDomain.com/scripts/myScript.php?url=anotherDomain.com/images/someImage.jpg&width=120&height=80
Due to some requirements I have to proxy these images this way, and I need to cache these images to ease the load on the server processing and re-sizing.
How do I go about configuring IIS7 to cache these urls?
I don't have in-depth knowledge of headers, so if needed, your elaboration will be very much appreciated.
thanks

click your site, click http Response headers, then click "set common headers", then expire web content and uncheck "immediately", then specify when you'd like it to expire.
Source

Related

How to know if resource was truly loaded from cache in chrome devtools?

Chrome devtools network tab shows "Transferred data over network" value of the same size of cached resource file. If I block the last request that appears on above image, picture isn't loaded, but the second request still shows the same amount of data was transferred. How to know if the image resource is really being pulled from cache and bandwidth is being saved?
Note: I'm using max-age Cache-control policy and in Firefox it is clearly working.
The ultimate answer to you question can be provided by the access logs of the server you are requesting the ressource from. Just add an "fingerprint parameter" to your request and check the access log from the server.
Another option would be using an extension like webQsse (https://chrome.google.com/webstore/detail/webqsee-web-sniffer-recor/gamdpfnfkjknkimfbboonmgdfnondfme) which also displays where the image is loaded from.

How do I know if my page is being cached?

I have a WordPress site that is doing a few weird things, and I believe it is because it is being cached. I changed the contents of a CSS stylesheet file, and the change took around 10 minutes before it appeared live.
I can't however find any caching mechanism setup. I've looked through cPanel and can't see anything setup there. The IP of the site resolves to the IP that cPanel is showing.
I've looked for plugins in WordPress and can't see any caching plugins (although if it was a caching plugin, would accessing a stylesheet be cached?).
Any tips on how I can see if the page is being cached on the server or by a plugin?
Put a JavaScript bug on the page which crafts a random URL and requests it. Compare the number of page requests to random URL requests. But there are lots of scenarios where a browser can cache a page in the absence of caching information.
If your website is behind Cloud Flare network or such, this is normal behavior.
Try running next command (Windows Command prompt/Linux terminal):
ping www.yoursite.com
and visit resolved IP address in browser - this may tell you if you are behind caching network.
Take a look at this article: http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/

Image server HTTP vs HTTPS in IIS

Using IIS6 on win2003, if I have an image server is it more efficient to serve up images as http than https? Also is it possible to serve up images as http on a webpage than is https.
Like if this html file: Secure.html is on a server that forces https to be used, but inside https://www.myultrahighsecurewebsite.com/Secure.html/
and I have a image like so:
<img src="http://www.notsosecureatall.com/imagecode/serveupanimage.aspx?id=1&auth=1" />
Is this a good way to serve up images? Is there a better way? Also I wanted to have a defacto site to serve up images so I don't have to push images as well as code and markup between development and live. Should the images or certain type of images like tiff, png, svg, etc... be on https vs http or does it matter?
If I do implement an image server or a page dedicated to keeping track of images, I just want an easy system to push images from development to my production environment without getting snagged on installation problems. But also not having to worry about customers having access to images until a version has been properly approved.
It will be more efficient from a CPU (client & server) and network point of view to use plain old HTTP. You'll avoid the overhead of TLS traffic and encryption/decryption of data.
The scenario (mixed HTTP/HTTPS) you present will often annoy a user though. You'll get a warning similar to "This page has unsecured content" (this is getting at the HTTP-only images).
See Loading http content on https website for more info (and additional gotchas) on the previous paragraph.
Are you sure that you need to worry about efficient loading of images? Don't overengineer this. Please share some more details if you've noticed that this is a problem.

is it possible to search firefox cache memory and disk cache

is it some how possible to search firefox cache entries from an application which is online and doesn't ask user to install anything on his computer...does mozilla provide any api for this or some functions to do this.
Probably not the cache you want, maybe something more along the line of
HTML5 local storage or Offline Web Application, apart from that it would be difficult to know what is in the entire cache due to security constrains, but you can use the server response header to detect what item the browser think it has in cache (detect the response 304 in http server header, if you provide the proper headers ).
I'm not sure if the local cache is available online from any other computer, but you can type about:cache in the URL bar and it'll take you to a page that can identify things in both memory and disk.
Hope that helps.

Understanding how images are served and cached

So I'm wondering how browsers treat requests for images. I'm hoping to use a cdn for serving product images on my website. I'd also like to use the cdn for serving button images and images used in my css.
The problem with this is that I don't have control over the expires headers (Rackspace files is what I'm looking into).
See, say I have a large image file as a background on my home page. So the page is accessed often, but the image stays the same. Is the browser going to request this image every time?
Or should I just use a cdn for my product images?
caching is quite a broad subject. I suggest you start by reading about the different kinds of caching here http://www.mnot.net/cache_docs/#BROWSER and how caching works here http://www.web-caching.com/mnot_tutorial/how.html
Now, to answer your question: assuming the user has caching enabled and the cdn response headers are properly configured a user visiting your page multiple times will only request that background image once until the cache expires or those files are cleaned.
No, AFAIK you need necessarily to add the 'cache' header to your images to enable browser caching. This is a great tutorial about it.
Additionally you can read this article from Yahoo to get a very brief view of the topics.
Review specially these topics of the article:
Minimize HTTP Requests
Add an Expires or a Cache-Control Header
Use a Content Delivery Network
Hope it helps you

Resources