Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bogdan Nedelcu 5 posts 26 karma points
    Jan 12, 2014 @ 15:46
    Bogdan Nedelcu
    0

    cache-control header for dynamic content

    Is there a best practices article showing how to configure output-cache in order to have the dynamic pages of umbraco from a NGINX, Varnish or a CDN site?

    thanks

  • Per Ploug 865 posts 3491 karma points MVP admin
    Jan 14, 2014 @ 10:39
    Per Ploug
    0

    Hmm, need some more info to answer that, what parts? - the umbraco backoffice or more in regard to the assets served as part of the front-facing website?

  • Bogdan Nedelcu 5 posts 26 karma points
    Jan 14, 2014 @ 12:16
    Bogdan Nedelcu
    0

    I refer to the front-facing website. Usually the CDN, Varnish or NGINX cache follows the output-cache HTTP header deciding if to store or not to store a cached copy of the page. I found no way to change that for the dynamic generated pages.

  • Bogdan Nedelcu 5 posts 26 karma points
    Jan 24, 2014 @ 12:13
    Bogdan Nedelcu
    0

    I wonder if in the urlrewrite module would it be possible to change the cache-control headers, based on some properties of the current document type?

  • Karl Kopp 121 posts 227 karma points
    Aug 31, 2014 @ 03:32
    Karl Kopp
    0

    Did u ever find a solution for this? I've also noticed the Cache-Control header for all HTML pages for the front-end web site are set to private. I've had to override the header in my CDN, but it would be smarter to be able to set it. I can't see anywhere you can set the Cache-Control header in Umbraco for the front-end website. Anyone??

  • Bogdan Nedelcu 5 posts 26 karma points
    Sep 01, 2014 @ 11:18
    Bogdan Nedelcu
    1

    Hi Karl,

    I used varnish as an intermediary layer to removed all headers coming from umbraco.
    On top of that i use NGINX to set headers to proper values. 

    here is the varnish script:

    sub vcl_backend_response {

                    unset beresp.http.cache-control;

                    set beresp.http.cache-control = "public, max-age=86400";

                    if (beresp.ttl < 120s) {

                                    unset beresp.http.cache-control;

                                    unset beresp.http.expires;

                                    set beresp.http.cache-control = "public, max-age=86400";

                                    set beresp.ttl = 1w;

                                    set beresp.http.magicmarker = "1";

                    }

    }

    sub vcl_deliver {
                            if (resp.http.magicmarker) {
                                            /* Remove the magic marker */
                                            unset resp.http.magicmarker;
                                            /* By definition we have a fresh object */
                                            set resp.http.age = "0";
                            }
    }

    Regards,

    Bogdan

  • Karl Kopp 121 posts 227 karma points
    Sep 02, 2014 @ 07:44
    Karl Kopp
    0

    Still sounds like a hack for what should work out of the box :) I'm using CloudFlare and with their PageRules (same thing as yr Varnish config) you can over ride the headers so have a short term solution, but it's still not right.

  • Bogdan Nedelcu 5 posts 26 karma points
    Sep 02, 2014 @ 08:29
    Bogdan Nedelcu
    0

    After some time I realized it's not so bad. I have two DNS pointing to the same Umbraco CMS, one of which is cached and exposed to the CDN and the other which is not cached helping me to check the latest version of the content. It's like separating the responsibilities between the server delivering content and the server caching the content. 

    Regards,

    Bogdan

Please Sign in or register to post replies

Write your reply to:

Draft