solidusjs / solidus

A simple server that generates pages from JSON and Templates
MIT License
28 stars 7 forks source link

No-cache requests #134

Closed joanniclaborde closed 8 years ago

joanniclaborde commented 8 years ago

Fixes #133

Solidus' resource cache is great to speed up pages for general users, but seriously slows down testing and publishing new content. This pull request introduces a new "no-cache mode" to fix this problem. The mode is enabled when the first subdomain of the host is preview (by default, configurable with the no_cache_subdomain option). This means a production site can be hosted and browsed normally on domain.com or abc.domain.com, and its no-cache version will be accessible through preview.domain.com or preview.abc.domain.com. This pull request makes Solidus follow the no-cache request headers, which are sent when a user forces-refresh a page in his browser.

When the Cache-Control: no-cache request is detected, the following changes happen to the request:

joanniclaborde commented 8 years ago

Note: I didn't use the "preview mode" name since it already exists.

joanniclaborde commented 8 years ago

Maybe the default subdomain should be no-cache instead of preview...