Nginx Uwsgi – Private cache

– For a public resource, we can cache without problem

– The problem is when we want caching for a private resource, imagine 2 different users (cookie different) want to access to same API: api/my_infos

=> So one of the solutions is:

– Either we add somethings in URL (Ex: api/me/my_infos, api/you/my_infos or api/me/my_infos) but the problem is if user try to add this info by him-self, the server will cache the wrong info.

=> The good solution:

In nginx: uwsgi_cache_key $request_url$cookie_cookie_name

comments powered by Disqus