Thruster caches x-sendfile response and gives a 404 on subsequent requests if the file is removed (rails full page caching)
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 58
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 6
Description
I have a very old blog I am trying to bring up to Rails 8 with Thruster.
The app uses Rails full page caching, ie:
```
caches_page :index, :show
```
On the posts controller. What I have found is that on the first load of the posts index, everything works great - rails writes the cache file into public/posts/index.html. However I think Thruster then caches the static file on the next load.
Later, when I add a new post, the cache gets swept, removing posts.html from the public folder.
At this stage, if I navigate back to /posts, the rails action does not run as Thruster immediately returns a 404. So Thruster must check if the cached file it has on disk still exists before serving it, and if it is not there, it does not fall back to the Rails action. At this point it is stuck as there is no way to expire the cache and rebuild the index.
Is there any setting I might be missing to make this work out of the box, or some sort of "no cache" header I can set to tell Thruster to not cache this sort of asset?
Contributor guide
Research direction
Reproduce the flow from /posts and posts#index using Rails full-page caching, including creation and removal of public/posts/index.html. Then trace Thruster's handling of the x-sendfile response and the missing static file; done means a swept cache no longer leaves /posts returning a permanent 404 and the Rails action can rebuild it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, rails
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100