Currently ETags are calculated based on the SHA1 hash of the file. This requires a file to be completely read before its tag can be calculated and put into the header of a request. To circumvent this, inert currently omits the ETag header until a complete file has been served to a client, caching the value for future requests.
The file hashing causes undue complexity for limited gains, and I would like to replace this with a value computed from: modification time + file size, similar to nginx & express.js.
As far as I can tell, this updated method should mainly affect cases where the same file is stored on multiple servers, served by different hapi instances behind a load balancer. Currently they are always served with the same ETag, but will require synchronization of the modification dates to achieve the same result with the new method.
I'm considering to completely replace the generation method but am also considering adding it as a new etagMethod option, to allow consistent tag values across servers for git deployed assets, etc.
Any input on this would be much appreciated.
Currently ETags are calculated based on the SHA1 hash of the file. This requires a file to be completely read before its tag can be calculated and put into the header of a request. To circumvent this, inert currently omits the ETag header until a complete file has been served to a client, caching the value for future requests.
The file hashing causes undue complexity for limited gains, and I would like to replace this with a value computed from:
modification time+file size, similar to nginx & express.js.As far as I can tell, this updated method should mainly affect cases where the same file is stored on multiple servers, served by different hapi instances behind a load balancer. Currently they are always served with the same ETag, but will require synchronization of the modification dates to achieve the same result with the new method.
I'm considering to completely replace the generation method but am also considering adding it as a new
etagMethodoption, to allow consistent tag values across servers for git deployed assets, etc.Any input on this would be much appreciated.