Feature #1209

should be able to disable ETag for static files

Added by alexlehm almost 7 years ago. Updated over 5 years ago.

Status:FixedStart date:
Priority:LowDue date:
Assignee:-% Done:

0%

Category:core
Target version:1.4.20
Missing in 1.5.x:

Description

When loadbalancing between two servers, the etags generated by the each server do not match when a file is first requested from server 1 and the checked against server 2 (this is not an issue specific to lighttpd, this happens with Apache as well).

In Apache, there is an option to disable or configure the calculation of the Etag value, as far as I can see such an option doesn't exist in lighttpd. I have simply patched the source code in mod_staticfile.c, but I would prefer to have this as an config option.

patch-try2 - Patch which provides etag.use-inode option -- yusufg (4.84 KB) Anonymous, 2007-06-14 05:50

patch-lighty-etag-disable - patch adds "static-file.etags" = "enable" | "disable" to completely disable etag -- yusufg (6.86 KB) Anonymous, 2007-06-14 10:14

patch-version4 - adds etag.use-mtime and etag.use-size option -- yusufg (8.85 KB) Anonymous, 2007-06-14 16:02

Associated revisions

Revision 1874
Added by jan almost 7 years ago

added static-file.etags, etag.use-inode, etag.use-mtime,
etag.use-size to customize the generation of ETags for
static files. (fixes #1209) (patch by <>)

History

#1 Updated by Anonymous almost 7 years ago

I second his request, for this and other reasons it should be possible to disable etag

#2 Updated by Anonymous almost 7 years ago

Attached patch provides a config option
etag.use-inode = "enable" | "disable" (default to "enable") which makes the ETag generation use the inode value or not. For running lighty in a server farm, it is recommended to use etag.use-inode = "disable"

Comments on the patch are appreciated but be gentle since its my first lighty patch

-- yusufg

#3 Updated by Anonymous almost 7 years ago

Replying to :

Attached patch provides a config option
etag.use-inode = "enable" | "disable" (default to "enable") which makes the ETag generation use the inode value or not. For running lighty in a server farm, it is recommended to use etag.use-inode = "disable"

Comments on the patch are appreciated but be gentle since its my first lighty patch

Sorry forgot to mention that the patch is relative to 1.4.15

-- yusufg

#4 Updated by Anonymous almost 7 years ago

I added another option based on weigon's advice
static-file.etags = "enable" | "disable" which decides whether to have ETag generation or not

-- yusufg

#5 Updated by Anonymous almost 7 years ago

Another revision based on advice from weigon. modifies etag_create to use bitmap flags and creates
two more options etag.use-mtime and etag.use-size.

patch-version4 is relative to 1.4.15

-- yusufg

#6 Updated by jan almost 7 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

patch applied in r1874

#7 Updated by glen almost 7 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (fixed)

looks like the "disabled" value is uninitialized, as if i disable etag option i get random values for ETag. note sleep 1 is needed too.


# for a in $(seq 1 10); do wget -S -O /dev/null http://localhost/500.html 2>&1 | grep ETag; sleep 1; done
  ETag: "-7619505750001792476" 
  ETag: "8428385971843460458" 
  ETag: "4467513548741689585" 
  ETag: "-6359908640125068086" 
  ETag: "-3235648356095079770" 
  ETag: "-5187084305365983648" 
  ETag: "7644173974411994873" 
  ETag: "-4145391447258360639" 
  ETag: "-2544186891902987353" 
  ETag: "7859331811392691821" 

# lighttpd -f /etc/lighttpd/lighttpd.conf -p|grep etag
    etag.use-inode                 = "disable" 
    etag.use-mtime                 = "enable" 
    etag.use-size                  = "enable" 

i used: .../branches/lighttpd-1.4.x) (revision 1878)

#8 Updated by Anonymous almost 7 years ago

Glen, Thanks for the bug report. I can reproduce it but as far as I can tell, I have set etag.use-inode as T_CONFIG_BOOLEAN and initialized it to 1 (in configfile.c) so I can't figure out why the behaviour is seen. Jan, any advice ?

-- yusufg

#9 Updated by darix almost 7 years ago

there are 2 options enabled for the etag "backend". can you add an log message that prints out which backend was used for the etag?

#10 Updated by Anonymous almost 7 years ago

and with stat cache disabled:


# lighttpd -f /etc/lighttpd/lighttpd.conf -p|grep stat-cache
    server.stat-cache-engine       = "disable" 
# for a in $(seq 1 10); do wget -S -O /dev/null http://lighttpd/500.html 2>&1 | grep ETag;
done
  ETag: "8428385971843460458" 
  ETag: "-6359908640125068086" 
  ETag: "-5187084305365983648" 
  ETag: "-4145391447258360639" 
  ETag: "7859331811392691821" 
  ETag: "-7915964940039907874" 
  ETag: "7809521096938437145" 
  ETag: "-4080159745028840153" 
  ETag: "3126185585067023604" 
  ETag: "-7211738937683960933" 

#11 Updated by darix almost 7 years ago

any remaining issues here or can we mark this as done?

#12 Updated by glen almost 7 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to fixed

no problems from my side :). closing

#13 Updated by mamo almost 7 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (fixed)

the option:

static-file.etags = "disable"

breaks mod_compress as this module uses etag when naming the compressed files

Btw. it will be very nice to get this etag patch in trunk aswell :-)

#14 Updated by darix almost 7 years ago

mod_compress is disabled now if no etag is found.

migration to trunk pending

#15 Updated by Anonymous over 6 years ago

Why it's not recognized in 1.4.15?

lighttpd-1.4.15 - a light and fast webserver
Build-Date: Jul 20 2007 23:46:47

service lighttpd restart
2007-08-03 12:25:35: (server.c.872) WARNING: unknown config-key: static-file.etags (ignored)

#16 Updated by darix over 6 years ago

this is new in 1.4.16

#17 Updated by stbuehler over 5 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to fixed

Fixed in r2245, see #1442.

Also available in: Atom