So, I’ve noticed that using Dart’s built in HttpServer class tends to make the client request for every file every time.
On Apache, it is possible to tell the client to cache the file for a maximum of a certain length of time — does Dart support this feature to lighten the load on HttpSever?
Thanks for the question! You can set any HTTP header in an HTTP response.
For instance:
If you want more sophisticated handling, such as respecting Etags or If-Modified-Since, you’ll probably have to add them yourself. In general, it makes sense to proxy the Dart HTTP Server behind a server such as Nginx or Apache, and then have that server take care serving all of your static files.