Refreshing the web page causes the static file read to be missed
jrobertson opened this issue · comments
James Robertson commented
Hello,
When I run the following code and add a text file called test.txt into the directory fun, it gets read on every subsequent web page refresh. Here's the code I used:
require 'rack-static-if-present'
use Rack::StaticIfPresent, :urls => ["/",'hidden.txt'], :root => "fun"
hello_world = lambda do |env|
[200, {"Content-Type" => "text/plain"}, ["Hello World!"]]
end
run hello_world
If I open the URL from the address bar more than once there isn't a problem. Which suggest there is some sort of caching request being sent from the browser that needs to be handled.
--
James Robertson
Sam Schenkman-Moore commented
Hmm! I barely remember the rationale for this gem!
It's not immediately obvious to me how that would happen, although this isn't a lot of code so maybe I'll look at it later. Do you have any more specific ideas?