Cache Control and image.a4d

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cache Control and image.a4d

Justin Will
Can someone advise on how best to set my cache control settings to allow my images served from images.a4d to be cached by the browser for a period of 90 minutes?  I have been playing with this and not sure I have it right.  Here's what I have tried and I get missing images if I put it before write png and seems to do nothing after write png.



                set expires(90)
                set cache control("max-age=5400")
                set response status(304)  // no change

and when I try this either before or after write png it seems to do nothing.

                set expires(90)
                set cache control("max-age=5400")


Thanks
Justin Will
_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Cache Control and image.a4d

David Ringsmuth-3
Justin,

If you are using nginx, you can cache them there as long as you like.

😊

David Ringsmuth

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Cache Control and image.a4d

Justin Will
David,

I agree I could cache them at the server as I do front end with NGINX but I would rather send the correct directives to the browser so we can use the browsers cache and further reduce network traffic.

Justin

From: [hidden email] [mailto:[hidden email]]
Sent: Thursday, September 29, 2016 10:30 AM
To: Justin Will <[hidden email]>; [hidden email]
Subject: RE: [Active4d-dev] Cache Control and image.a4d

Justin,

If you are using nginx, you can cache them there as long as you like.

😊

David Ringsmuth

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Cache Control and image.a4d

Aparajita Fishman
In reply to this post by Justin Will
Hi Justin,

You almost got it right. You have to put ‘set expires’ and ‘set cache control’ before ‘write png’, because the interpreter stops executing after one of the ‘write <image>’ commands.

What you *don’t* want to do is to set the response status. If you always return 304, the browser will ignore the image. Just returning the proper cache headers will force the browser to cache the image, and subsequent requests – as long as the URL is exactly same, including query params – will come from the cache until it expires.

All the best,

  - Aparajita

> On Sep 29, 2016, at 7:40 AM, Justin Will <[hidden email]> wrote:
>
> Can someone advise on how best to set my cache control settings to allow my images served from images.a4d to be cached by the browser for a period of 90 minutes?  I have been playing with this and not sure I have it right.  Here's what I have tried and I get missing images if I put it before write png and seems to do nothing after write png.
>
>
>
>                set expires(90)
>                set cache control("max-age=5400")
>                set response status(304)  // no change
>
> and when I try this either before or after write png it seems to do nothing.
>
>                set expires(90)
>                set cache control("max-age=5400")
>
>
> Thanks
> Justin Will
> _______________________________________________
> Active4D-dev mailing list
> [hidden email]
> http://list.aparajitaworld.com/listinfo/active4d-dev
> Archives: http://active4d-nabble.aparajitaworld.com/


_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/