JosephSilber/page-cache

How to set cache header?

sanjayojha opened this issue · 1 comments

I am using this package and its working as mentioned. But is there a way to determine if page is served by cache or from server?
I mean, can we set a header something like x-page-cache: HIT if page is served via cache and x-page-cache-:MISS if page is delivered from server ?

Ok it seems easy to do so.
I have edited the ngnix conf and set the header as below

add_header x-page-cache HIT;

put this in location block's try_files as mentioned in readme guide.

Above it, set the below header

add_header x-page-cache MISS;

And you are done.