lighttpd - expire.url - how it realy works?

Discussion in 'Server Operation' started by Ruthwen, May 19, 2021.

  1. Ruthwen

    Ruthwen New Member

    Hi.
    I didn't find answer in documentation, so i'm asking you: how lighttpd is setting expire.url parameter?
    Example of configuration:
    Code:
    $HTTP["host"]               =~ "static\.example\.tld.*" {
        server.document-root            = "/var/www_static/static.example.tld/web/"
        url.rewrite-once                = ( "^/([0-9a-z.-]*/)(.*)?$" => "/$1web/$2" )
        static-file.etags               = "disable"
        etag.use-inode                  = "disable"
        etag.use-mtime                  = "disable"
        compress.filetype               = ( "text/plain","text/css", "text/xml", "text/javascript", "application/javascript" )
        compress.allowed-encodings      = ( "gzip", "deflate" )
        $HTTP["url"]            =~ "\.(jssc|css|json)$" {
            expire.url                  = ( "" => "now plus 3600 seconds" )
        }
        $HTTP["url"]            =~ "\/latest\/" {
            expire.url                  = ( "" => "now plus 3600 seconds" )
        }
        $HTTP["url"]            =~ "\/internal\/example.cookiepolicy" {
            expire.url                  = ( "" => "now plus 86400 seconds" )
        }
        expire.url                      = ( "" => "now plus 1 years" )
        setenv.add-response-header      += (
            "Cache-Control"                => "private"
        )
    }
    
    So I have two different expire.url parameters for *.js file, one from url (now plus 3600 seconds) and second from host section (now plus 1 years).
    When I make a request for js file, I have response expire: 3600s, ok, but I have also Cache-Control: private, so why lighttpd was set cache-contreol but didn't overwrite expire by "host" value?
     

Share This Page