D
D
Dmitry Shnyrev2014-11-08 13:00:50
go
Dmitry Shnyrev, 2014-11-08 13:00:50

How to fix problem with http.FileServer?

Today I encountered an unusual problem, not even a problem, but a glitch.
for development purposes, to return statics, I use http.FileServer like this:

goji.Get("/assets/*", http.StripPrefix("/assets/", http.FileServer(http.Dir(rootDir+"/assets"))))

the first time you load a resource file, it renders just fine.
BUT then the mysticism begins:
I change the contents of the file, but when loading, the old contents are given, as if from the cache. But what is most surprising is that the old content is given with the size of the new file, i.e. if I add something to the source file, then bugs will be added to the old content, or if I delete something from the source file, the old content will return, but already cut off.
The saddest thing is that rebooting the dev server does nothing. Running under gin or directly doesn't change anything either. Only a hard reboot of the system helps (I use Ubuntu 14.04 LTS).
Here are a couple of screenshots:
this is the file just created and its first load
snag.gy/1MhZg.jpg
snag.gy/IlVI6.jpg
this is after the changes
snag.gy/GlkG7.jpg
snag.gy/D685H.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shnyrev, 2014-11-08
@dmnBrest

Found the answer.
stackoverflow.com/questions/20702221/http-fileserv...
There is a problem with Vagrant and shared forder along the way. Exactly my case!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question