Dear John,

The option "gzip_static" requires, that the files to be delivered are gzip
compressed in the file system. In order to have "gzip_rerfresh" working
(automatically re-compress the file when the version has changed) requires
that the server has write permissions on the .gz file and that "gzip_cmd"
points to the gzip program.

Below is something some data from a life site (openacs.org) having
static gzip delivery enabled with a snippet from the config file.

There is no extra filter necessary to get this working.

best regards
-gustaf neumann

URL: http://www.openacs.org/resources/openacs-bootstrap3-theme/css/all.min.css

Snippet from the config file:

#---------------------------------------------------------------------
# Global fastpath parameters
#---------------------------------------------------------------------
ns_section      "ns/fastpath"
    #ns_param        cache               true       ;# default: false
    #ns_param        cachemaxsize        10240000   ;# default: 1024*10000
    #ns_param        cachemaxentry       100000     ;# default: 8192
    #ns_param        mmap                true       ;# default: false
    ns_param        gzip_static         true       ;# check for static gzip; 
default: false
    ns_param        gzip_refresh        true       ;# refresh stale .gz files 
on the fly using ::ns_gzipfile
    ns_param        gzip_cmd            "/bin/gzip -9"  ;# use for 
re-compressing


files in the file system
/var/www/openacs.org/packages/openacs-bootstrap3-theme/www/resources/css# ls 
-ltr
-rw-rw-r-- 1 openacs  nsadmin 115102 Jul 15  2016 all.min.css
-rw-rw-r-- 1 openacs  nsadmin  20213 Jul 15  2016 all.min.css.gz
...

Reply header fields:

Accept-Ranges   |bytes|
Connection      |keep-alive|
Content-Encoding        |gzip|
Content-Length  |20213|
Content-Type    |text/css|
Date    |Sat, 14 Jan 2017 15:01:46 GMT|
Expires |Mon, 13 Feb 2017 15:01:46 GMT|
Last-Modified   |Fri, 15 Jul 2016 15:39:21 GMT|
Server  |NaviServer/4.99.15|
Vary    |Accept-Encoding|
X-Content-Type-Options  |nosniff|
X-Frame-Options |SAMEORIGIN|
X-XSS-Protection        |1; mode=block|

Am 14.01.17 um 06:10 schrieb John from Decent Espresso:
I’m struggling a bit to get naviserver to gzip static content (.js and.css). ADP gzipping is working. According to the docs, it’d seem that all I need to do is enable all the fastpath config stuff below, and it’d work, but that’s not doing the trick. Perhaps there is additional fast path configuring to do to enable certain directories? According to this code by Daniel Clark, a fast path filter is needed to make this work, but it seems that (a) his code may not be current and (b) his filter doesn’t work because he doesn’t supply the other dependent functions his code calls.
https://www.qcode.co.uk/post/121
I’ve looked at the fastpath.c/fastpath.tcl as the docs indicated, but was not illuminated. I probably just don’t know where to look, but after about 2h of banging on this, I thought I’d ask for help….
-john
ns_section"ns/fastpath"
   # Enable cache for normal URLs. Optional, default is false.
   ns_paramcachetrue
   # Size of fast path cache. Optional, default is ~10M.
   ns_paramcachemaxsize[expr 1024*10000]
   # Largest file size allowed in cache. Optional, default is 8K
   ns_paramcachemaxentry8192
   # Use mmap() for cache. Optional, default is false.
   ns_parammmaptrue
# Return gzip-ed variant, if available and allowed by client (default false)
   ns_paramgzip_statictrue
# Refresh stale .gz files on the fly using ::ns_gzipfile (default false)
   ns_paramgzip_refreshtrue
# Return the specified command for re-compressing when gzip file is outdated
   ns_paramgzip_cmd"/usr/bin/gzip -9"

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi

_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

--
Univ.Prof. Dr. Gustaf Neumann
WU Vienna
Institute of Information Systems and New Media
Welthandelsplatz 1, A-1020 Vienna, Austria
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to