[Resolved] expires header not working for js/png files unless htaccess is in place ?

Discussion in 'Install/Configuration' started by eva2000, Oct 5, 2010.

  1. eva2000

    eva2000 Member

    Currently on 4.0.16 previously don't recall having this issue though. On test install of vB4 forum the javascript and png files are NOT setting the expires header at all but css and text files set it correctly. But if i add in .htaccess the line BELOW, then it works and sets expires header for png and js files.

    Code:
    ExpiresActive On
    site is on subdomain i.e. host2.domain.com

    The problem is prior to this i didn't have to do this, so what's changed ? Something in WHM conflicting ?

    settings

    [​IMG]

    not working

    [​IMG]

    with htaccess set with ExpiresActive On is working though

    [​IMG]

    I don't have this problem with css or text files properly setting expires header though.

    Attached Files:

    Last edited by a moderator: Oct 7, 2010
  2. mistwang

    mistwang LiteSpeed Staff

    Please check and make sure the MIME type is defined for javascript and png in LiteSpeed main MIME configuration file.
    Try new 4.0.17 release.
  3. eva2000

    eva2000 Member

    do you mean file at /usr/local/lsws/conf/mime.properties ?

    this is what it contains
    Code:
    default = application/octet-stream
    3gp     = video/3gpp
    3g2     = video/3gpp2
    ai, eps   = application/postscript
    aif, aifc, aiff = audio/x-aiff
    asc     = text/plain
    asx     = video/x-ms-asf
    au      = audio/basic
    avi     = video/x-msvideo
    bcpio   = application/x-bcpio
    bin     = application/octet-stream
    bz, bz2 = application/x-bzip
    cdf     = application/x-netcdf
    class   = application/java-vm
    cpio    = application/x-cpio
    cpt     = application/mac-compactpro
    crt     = application/x-x509-ca-cert
    csh     = application/x-csh
    css     = text/css
    dcr,dir, dxr = application/x-director
    dms     = application/octet-stream
    doc     = application/msword
    dtd     = application/xml-dtd
    dvi     = application/x-dvi
    etx     = text/x-setext
    exe     = application/x-executable
    ez      = application/andrew-inset
    flv     = video/x-flv
    gif     = image/gif
    gtar    = application/x-gtar
    gz, gzip  = application/gzip
    hdf     = application/x-hdf
    hqx     = application/mac-binhex40
    html, htm    = text/html
    ice     = x-conference/x-cooltalk
    ico     = image/vnd.microsoft.icon
    ief     = image/ief
    iges, igs    = model/iges
    iso     = application/x-cd-image
    java    = text/plain
    jar     = application/java-archive
    jnlp    = application/x-java-jnlp-file
    jpeg, jpe, jpg    = image/jpeg
    js      = application/x-javascript
    js2     = application/javascript
    jsp     = text/plain
    kar     = audio/midi
    latex   = application/x-latex
    lha, lzh = application/octet-stream
    man     = application/x-troff-man
    me      = application/x-troff-me
    mesh    = model/mesh
    mid, midi  = audio/midi
    mif     = application/vnd.mif
    movie   = video/x-sgi-movie
    mov     = video/quicktime
    mp2, mp3, mpga  = audio/mpeg
    mpeg, mpe, mpg  = video/mpeg
    mp4     = video/mp4
    ms      = application/x-troff-ms
    msh     = model/mesh
    nc      = application/x-netcdf
    oda     = application/oda
    ogg     = application/ogg
    pbm     = image/x-portable-bitmap
    pdb     = chemical/x-pdb
    pdf     = application/pdf
    pgm     = image/x-portable-graymap
    pgn     = application/x-chess-pgn
    pls     = audio/x-scpls
    png     = image/png
    pnm     = image/x-portable-anymap
    ppm     = image/x-portable-pixmap
    ppt     = application/vnd.ms-powerpoint
    ps      = application/postscript
    qt,qtvr = video/quicktime         
    ra      = audio/x-realaudio   
    ram, rm = audio/x-pn-realaudio
    rar     = application/x-rar-compressed
    ras     = image/x-cmu-raster
    rgb     = image/x-rgb    
    roff, t, tr    = application/x-troff
    rss     = application/rss+xml     
    rsd     = application/rsd+xml
    rtf     = application/rtf     
    rtx     = text/richtext      
    ser     = application/java-serialized-object
    sgml, sgm    = text/sgml            
    sh      = application/x-sh          
    shar    = application/x-shar
    silo    = model/mesh
    sit     = application/x-stuffit      
    skd, skm, skp, skt     = application/x-koan
    smi,smil     = application/smil
    snd     = audio/basic        
    spl     = application/x-futuresplash
    sql     = text/x-sql   
    src     = application/x-wais-source
    sv4cpio = application/x-sv4cpio   
    sv4crc  = application/x-sv4crc
    svg, svgz = image/svg+xml
    swf     = application/x-shockwave-flash
    tar     = application/x-tar 
    tcl     = application/x-tcl
    tex     = application/x-tex       
    texi, texinfo    = application/x-texinfo
    tgz     = application/x-gtar     
    tiff, tif    = image/tiff         
    tsv     = text/tab-separated-values
    txt     = text/plain     
    ustar   = application/x-ustar   
    vcd     = application/x-cdlink
    vrml    = model/vrml              
    vxml    = application/voicexml+xml    
    wav     = audio/x-wav         
    wax     = audio/x-ms-wax          
    wbmp    = image/vnd.wap.wbmp    
    wma     = audio/x-ms-wma
    wml     = text/vnd.wap.wml
    wmlc    = application/vnd.wap.wmlc
    wmls    = text/vnd.wap.wmlscript   
    wmlsc   = application/vnd.wap.wmlscriptc
    wtls-ca-certificate = application/vnd.wap.wtls-ca-certificate
    wrl     = model/vrml
    xbm     = image/x-xbitmap
    xhtml, xht   = application/xhtml+xml
    xml, xsl = application/xml 
    xslt    = application/xslt+xml
    xpm     = image/x-xpixmap   
    xwd     = image/x-xwindowdump
    xyz     = chemical/x-pdb
    zip     = application/zip       
    z       = application/compress
    
    from site's cpanel control panel list of mime types

    Code:
    application/andrew-inset      ez
    application/atom+xml     atom
    application/cgi     cgi
    application/mac-binhex40     hqx
    application/mac-compactpro     cpt
    application/mathml+xml     mathml
    application/msword     doc
    application/octet-stream     bin dms lha lzh exe class so dll dmg iso
    application/oda     oda
    application/ogg     ogg
    application/pdf     pdf
    application/perl     pl plx ppl perl pm
    application/postscript     ai eps ps
    application/rdf+xml     rdf
    application/ruby     rb
    application/smil     smi smil
    application/srgs     gram
    application/srgs+xml     grxml
    application/vnd.mif     mif
    application/vnd.mozilla.xul+xml     xul
    application/vnd.ms-excel     xls
    application/vnd.ms-powerpoint     ppt
    application/vnd.rn-realmedia     rm
    application/vnd.wap.wbxml     wbxml
    application/vnd.wap.wmlc     .wmlc wmlc
    application/vnd.wap.wmlscriptc     .wmlsc wmlsc
    application/voicexml+xml     vxml
    application/x-bcpio     bcpio
    application/x-cdlink     vcd
    application/x-chess-pgn     pgn
    application/x-compress     .Z
    application/x-cpio     cpio
    application/x-csh     csh
    application/x-director     dcr dir dxr
    application/x-dvi     dvi
    application/x-futuresplash     spl
    application/x-gtar     gtar
    application/x-gzip     .gz .tgz
    application/x-hdf     hdf
    application/x-httpd-php     php php3 php4 php5 php6
    application/x-httpd-php-source     phps
    application/x-img     img
    application/x-javascript     js
    application/x-koan     skp skd skt skm
    application/x-latex     latex
    application/x-netcdf     nc cdf
    application/x-pkcs7-crl     .crl
    application/x-sh     sh
    application/x-shar     shar
    application/x-shockwave-flash     swf
    application/x-stuffit     sit
    application/x-sv4cpio     sv4cpio
    application/x-sv4crc     sv4crc
    application/x-tar     .tgz tar
    application/x-tcl     tcl
    application/x-tex     tex
    application/x-texinfo     texinfo texi
    application/x-troff     t tr roff
    application/x-troff-man     man
    application/x-troff-me     me
    application/x-troff-ms     ms
    application/x-ustar     ustar
    application/x-wais-source     src
    application/x-x509-ca-cert     .crt
    application/xhtml+xml     xhtml xht
    application/xml     xml xsl
    application/xml-dtd     dtd
    application/xslt+xml     xslt
    application/zip     zip
    audio/basic     au snd
    audio/midi     mid midi kar
    audio/mp4     a-latm m4p m4a mp4
    audio/mpeg     mpga mp2 mp3
    audio/x-aiff     aif aiff aifc
    audio/x-mpegurl     m3u
    audio/x-ms-wax     wax
    audio/x-ms-wma     wma
    audio/x-pn-realaudio     ram ra
    audio/x-wav     wav
    chemical/x-pdb     pdb
    chemical/x-xyz     xyz
    image/bmp     bmp
    image/cgm     cgm
    image/gif     gif
    image/ief     ief
    image/jpeg     jpeg jpg jpe
    image/png     png
    image/svg+xml     svg
    image/tiff     tiff tif
    image/vnd.djvu     djvu djv
    image/vnd.wap.wbmp     .wbmp wbmp
    image/x-cmu-raster     ras
    image/x-icon     ico
    image/x-portable-anymap     pnm
    image/x-portable-bitmap     pbm
    image/x-portable-graymap     pgm
    image/x-portable-pixmap     ppm
    image/x-rgb     rgb
    image/x-xbitmap     xbm
    image/x-xpixmap     xpm
    image/x-xwindowdump     xwd
    model/iges     igs iges
    model/mesh     msh mesh silo
    model/vrml     wrl vrml
    text/calendar     ics ifb
    text/css     css
    text/html     .shtml .shtml html htm shtml
    text/plain     asc txt
    text/richtext     rtx
    text/rtf     rtf
    text/sgml     sgml sgm
    text/tab-separated-values     tsv
    text/vbscript     vbs
    text/vnd.wap.wml     .wml wml
    text/vnd.wap.wmlscript     .wmls wmls
    text/x-config     cnf conf
    text/x-log     log
    text/x-registry     reg
    text/x-setext     etx
    text/x-sql     sql
    video/mpeg     mpeg mpg mpe
    video/quicktime     qt mov
    video/vnd.mpegurl     mxu m4u
    video/x-msvideo     avi
    video/x-sgi-movie     movie
    x-conference/x-cooltalk     ice
    Last edited: Oct 6, 2010
  4. eva2000

    eva2000 Member

    k just updated to 4.0.17 and on logging into admin control panel the first log entries read

    but still js and png files don't set expires header properly unless htaccess is set
    Last edited: Oct 6, 2010
  5. mistwang

    mistwang LiteSpeed Staff

    those warnings are harmless.
    Are you using LiteSpeed with hosting control panel? or configure everything in native configuration?
    How the expires configuration being set?
  6. eva2000

    eva2000 Member

  7. NiteWave

    NiteWave Administrator

    can you switch back to apache, check if png/js/css/jpg has Expires header or not?
  8. eva2000

    eva2000 Member

    Ah interesting it's working once i added apache mod_expires ??? more interesting is that the expire duration for most mime types is now taken from apache mod_expires overriding what is set in litespeed admin control panel. The exception being css mime type files now has expire duration of

    which doesn't correspond to either apache mod_expires nor does it match litespeed set css type ? so where is being set to max-age=31536000 ?

    Code:
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType application/x-javascript A1209600
        ExpiresByType text/javascript A1209600
        ExpiresByType application/javascript A1209600
        ExpiresByType text/css A1209600
        ExpiresByType image/x-icon A2592000
        ExpiresByType image/icon A2592000
        ExpiresByType application/x-ico A2592000
        ExpiresByType application/ico A2592000
        ExpiresByType image/gif A2592000
        ExpiresByType image/jpeg A172800
        ExpiresByType image/jpg A172800
        ExpiresByType image/png A172800
        ExpiresByType application/x-shockwave-flash A172800
    </IfModule>
    disregard css issue, once set vb for css to saved as file in admincp, it picked up mod_expires set duration overriding litespeed values for css like other mime types.

    So basically for expires to work for litespeed/whm/cpanel server, mod_expires for apache needs to be configured !
    Last edited: Oct 6, 2010
  9. NiteWave

    NiteWave Administrator

    just browse a vB 4 source, looks like css.php did the trick. but no test.
  10. eva2000

    eva2000 Member

    ah yes css.php :)

    so is this by design or a bug that apache mod_expires overrides litespeed values for expire types and that mod_expires needs to be set for litespeed to process png and css files for expire headers - only 2 mime types need for this requirement?
  11. mistwang

    mistwang LiteSpeed Staff

    It is by design, we want LiteSpeed behave exactly the same as Apache when load Apache httpd.conf.
    However, enabling expires header by default regardless Apache configuration may not be bad idea either. it only helps. So, yeah, we may turn it on by default in next release. :)
  12. NiteWave

    NiteWave Administrator

    and, if not read apache's httpd.conf, in lsws native configuration, Expires header is enabled by default for png/js/css/jpg.

    I'd mark this thread as Resolved.

Share This Page