문제

As you know infinite-scroll does repeated ajax request to get new content, and now hits directly Apache because the call is POST, and it has Cookies. We store in the session the last displayed item for each visitor, that's why the session hence the cookies.

We would like to take advantage of Varnish caching, so we are looking to improve this, and we are wondering what are out options here, as we need to do without cookies, without POST (so there is no user real identification).

도움이 되었습니까?

해결책

We store in the session the last displayed item for each visitor

You can pass this information as a query string in the url of the next page. Also try not to use POST for loading a next page, use GET requests.

다른 팁

I have use caching with Infinite scroll based on the example code provided on the github page here the part we specifically need to look at is as follows...

nextSelector: "div.navigation a:first",
navSelector: "div.navigation",

The next 'section' loaded by the infinite scroll is picked up by read a link and getting the page contents.

As far as my knowledge goes, it uses the jQuery Load Feature and that feature states the following...

Request Method

The POST method is used if data is provided as an object; otherwise, GET is assumed.

Therefore most standard caching techniques should work fine. I hope this helps, although i'm not familiar with varnish this should point you in the right direction.

Following the code above each link picked up by nextselector can contain GET Parameters for dynamic content.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top