ETag

#1
I was just curious if there's a reason LSWS doesn't generate ETag headers for dynamic content (eg, PHP output via LSAPI).

ETag is basically the only use I have left for cgi_buffer, and I'd like to just get rid of cgi_buffer completely :).
 
#3
mistwang said:
If you want ETag header, you can generated it from PHP side.
Ya, that's basically what I was using cgi_buffer. Was just curious since you have gzip support for dynamic content and ETag support for static content, if there was a reason you don't do ETag for dynamic :). It seems like it would be cleaner to keep that in the server instead of having to do it in all of the backends (PHP, Ruby, perl, FastCGI, etc).

Thanks for the reply.
 

mistwang

LiteSpeed Staff
#4
Maybe we will add it when we implementing the disk cache.
Calculating something like MD5 checksum for each every dynamic request is pretty expensive though. Any other idea for ETag calcuation? cgi_buffer uses MD5
 
Last edited:

mistwang

LiteSpeed Staff
#5
And there is annother issue with generating ETag dynamically, web server have to wait till the last byte of response body before it can start sending response back to client.
 
#6
What's the use of an ETag for dynamic content generated outside its application?

For example I use etags within my forum project. There I create the etag on the fly based on the board_id+topic_id+page+highrestimer(of the last change in the database). This is done prior to anything else. If that plus the user_id matches against the one given with the request I can leave the app asap. If not I use the current etag to check the request against the forum's build in cache, so re-building the whole content can be avoided. Only if that fails, the base page is build, then the user specific things added.

The server on the other hand knows nothing like that. It can only check the data the application is sending. To create something like a checksum from that beats the benefits of an etag to dust. Besides, if the data is user specific or if it's created based on the query string or a post, it's not cacheable, making the whole thing more than useless. If the content is created time specific, then a normal expires will do just fine. If it's just a redirected static file, then there should be no problem either.

So basically I can't see much benefit of an etag for dynamic content without the app itself managing it.
 
Top