Go's embed.FS and http.FileServer interact unexpectedly

(listen-to-euterpe.eu)

2 points | by iron4o 7 hours ago ago

3 comments

  • iron4o 7 hours ago ago

    I've noticed that browser caching with Last-Modified and If-Modified-Since is not working on my projects where embed.FS and http.FileServer are used. Which is quite a lot of them.

    I guess that my investigation and solution may be helpful to others.

    • is_taken 5 hours ago ago

      Maybe wrapfs.WithModTime(... should not use time.Now() but get the mod time of the running binary?

      • iron4o 4 hours ago ago

        Well, this is left to the application developer to decide and the library should not make the choice for them. In my own application it makes sense to use time.Now(), for example.