Giter VIP home page Giter VIP logo

Comments (4)

jinty avatar jinty commented on September 27, 2024

Interesting. Using cache control rather than a random token would definite be better. Would you be able to work up a pull request?

from prerender-cloudfront.

berenddeboer avatar berenddeboer commented on September 27, 2024

@akr4 how exactly does this work? Prerender needs to visit the site without CloudFront doing any caching. I can't see how Cache-Control would help here, that's nice when returning data from your origin, but after you rewrite the origin, prerender will visit the site as if it was a browser: how would you avoid caching then? I.e. you want to avoid caching for incoming requests.

from prerender-cloudfront.

berenddeboer avatar berenddeboer commented on September 27, 2024

Ah, I think I understand how this could work: on viewer-request check if the user-agent is "Prerender". In that case you should make sure a cached version is never returned. Not sure yet how.

Then on origin-response you set "Cache-Control".

from prerender-cloudfront.

akr4 avatar akr4 commented on September 27, 2024

@berenddeboer Returning the Cache-Control header from origin-response prevents CloudFront from caching the response. In addition to that, you need to set a header in viewer-request to distinguish the request is from prerender.io. And add it to a cache key of your CloudFront settings.

from prerender-cloudfront.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.