Jump to content

Cached pages for guests on AWS Cloudfront or another CDN


Recommended Posts

I want to serve cached pages for guests directly from Cloudfront cache (first hit). No origin request.

On pages requests IPS sends these headers (using Redis as cache method and 1 hour caching for guests on¬†AdminCPūüėě

cache-control: no-cache="Set-Cookie", max-age=3600, public, s-maxage=3600, stale-while-revalidate, stale-if-error
set-cookie: ips4_IPSSessionFront=75kv76vm8so67kh861iqhu7jky; path=/; secure; HttpOnly

To cache pages on Cloudfront, these headers should not be sent: no-cache="Set-Cookie" and set-cookie: ips4_IPSSessionFront=75kv76vm8so67kh861iqhu7jky; path=/; secure; HttpOnly.

I don't care about users online counter and don't use any guest posting feature. Guests can only read content. There is no interaction for guests. For them, serving "static pages" from the CDN is fine for some minutes, what would be much more faster and less resource intensive.

Is there a constants.php setting to remove the set-cookie (IPSSessionFront) for guests?

Link to comment
Share on other sites

Using this guest page cache is a very bad idea in my opinion.
Yes, what you wrote can probably be done - I don't know how, but you try reflect on a possible situation (I have observed such - and with less cache time) - what I mean.
You want to use one hour of cache - but after that one hour, if a user with a slow internet connection is the first creator of that page - then for the next one hour, your guests will see a very bad version of your site... no matter where ( in the case as you say - cloud cache) they will receive this.
If you want your guests to receive limited, but high-quality (and probably much faster, due to the limited content of your main site), then use conditionals of the type - "if the user is registered - this, if not  ... " etc. This practice will save you resources for guests, and better performance such as site loading speed for example.

Link to comment
Share on other sites

9 hours ago, Marc Stridgen said:

I have moved this to our developer area for you, as this is custom development rather than standard support. 

Thanks Marc. Is it on Home > Forums > Developers > Customization Resources > Development Assistance? Could not find there.

Link to comment
Share on other sites

  • 1 month later...

There is no way to prevent that cookie from being set, because it is being set by PHP itself (we use the built-in PHP session handling with a custom handler to push them to the database).

You should be able to configure your Cloudfront distribution to ignore that particular cookie for caching purposes, however, though this is unfortunately not something we can assist with.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
√ó
√ó
  • Create New...