luci/libs
Jo-Philipp Wich 001e15a0db [PATCH] Explicit Cache-Control for lucid.http static content
The Chrome web browser revalidates every resource if no explicit Cache-Control or Expires HTTP/1.1 header is sent. This makes the page loads appear to take a long time on pages with a few external resources, adding 300-500ms 
per item. This includes the XHR json responses that set page images, like wireless signal indicators and the like-- the images are revalidated on every XHR response. As an example, the Network -> Interfaces page generates 16 
requests to the lucid http server:

    Main HTML
    cascade.css
    xhr.js
    tabbg.png
    cbi.js
    loading.gif
    ethernet_disabled.png
    reload.png
    reset.gif
    edit.gif
    remove.gif
    add.gif
    bridge.png
    vlan.png
    wifi.png
    iface_status 

Of those, 14 should be pulled from cache but they are all valdiated. The lucid server returns the correct 304 (Not Modified) responses but it delays the apparent page load time because of the backlog it creates at the http 
server.

I would suggest setting explicit cache control on all files returned by the lucid http directory dispatcher. The "Expires" header is reportedly more widely supported, however this relies on the clock on the OpenWrt? system 
being accurate, which may not be the case. The "Cache-Control: max-age=" allows the server to set a timeout in seconds. I've included a patch that sets revalidate interval to 1 year, which is the value recommended by google.
Reference:  http://code.google.com/speed/page-speed/docs/caching.html

Note this could create an issue if there are luci application which are generating files which change that are being served by the lucid http DirectoryPublisher?. I'm not sure if there is anyone doing that. If needed, this can 
probably be created as an option to the DirectoryPublisher? config stanza for each vhost.

Finally, this only affects the Google Chrome browser, as both IE9 and Firefox seem to have their own revalidation interval in the absence of explicit cache control which may be based on the last modified time of the resource. 
Even in Chrome, this change doesn't take effect until the item is re-served with a 200 HTTP response so Chrome's cache should be cleared after this patch is applied. The patch can be extended to include cache control on 304 
responses, but I'd not worry about cluttering the code with it because the problem will solve itself once chrome redownloads the resource.
2012-01-09 00:04:54 +00:00
..
core libs/core: remove various uses of global vars in luci.ip 2012-01-01 15:51:37 +00:00
fastindex * Rewrote Luci to be coroutine-safe allowing the use of non-forking webservers 2008-06-14 14:12:12 +00:00
httpclient libs/httpclient: return server response line in error case (#249) 2011-06-25 22:57:18 +00:00
ipkg libs/ipkg: give caller more control over filter pattern 2011-10-15 03:10:19 +00:00
json libs/json: Fix a typo and a logic error in json.lua to make luci.json.encode() work like expected (#220) 2011-04-17 11:39:17 +00:00
lmo libs/lmo: skip all entries with identical key and value when generating lmo archives 2011-01-02 18:16:54 +00:00
lucid libs/lucid: fix process function leak (#285) 2011-08-11 23:23:11 +00:00
lucid-http [PATCH] Explicit Cache-Control for lucid.http static content 2012-01-09 00:04:54 +00:00
lucid-rpc GSoC: Documentation #2 2009-06-14 08:51:43 +00:00
nixio [PATCH] Abstract address UNIX sockets not binding properly (by capnbry@gmail.com, #366) 2011-12-16 02:10:37 +00:00
px5g libs/px5g: fix compilation on OpenWrt trunk 2010-11-16 16:30:07 +00:00
rpcc GSoC: Add RPC client 2009-06-14 09:02:40 +00:00
sgi-cgi Add possibility to show execution time in the footer 2010-11-23 01:02:21 +00:00
sgi-luci Make LuCIttpd work OOTB 2008-12-07 11:47:59 +00:00
sgi-uhttpd libs/sgi-uhttpd: move exectime inside handle_request 2010-12-15 01:04:38 +00:00
sgi-wsapi Made SGIs even more standards compliant (respect EOF command from LuCI) 2008-07-23 18:52:12 +00:00
sys From c63e369d57cb6862a8890c7b2ee1b6b449b2c42d Mon Sep 17 00:00:00 2001 2011-12-05 16:38:54 +00:00
web libs/web: remove debugging code 2012-01-08 23:39:29 +00:00