How can I force caching for 404 pages?

Right now, 404 pages don’t generate a cache. Always having this header status:

X-SRCache-Fetch-Status	MISS
X-SRCache-Store-Status	BYPASS

Please check https://github.com/openresty/srcache-nginx-module#srcache_store_statuses

We are using default.

May be you can ee site edit and add srcache_store_statuses 200 301 302 404; to it under server block.

How about caching all request, regardless of http response status?

I just added: srcache_store_statuses 200 201 301 302 404 503;

Thanks!

I hope you are getting expected cache response header :slight_smile:

You may report this on - https://github.com/openresty/srcache-nginx-module/issues/

Or simply add 500, 502 and 504. These together with 200 301 302 404 will cover most of HTTP traffic.

1 Like