httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emir Ibrahimbegovic <emir.ibrahimbego...@gmail.com>
Subject [users@httpd] Response headers set by apache
Date Sat, 30 May 2015 00:26:08 GMT
I've got an app that runs on a tomcat web server, and I use mod-jk on my
apache web server side.

I think I've managed to configure everything to work seamlessly, I ran into
issues when I wanted to cache static assets on webserver, for some reason
my response headers expires is set to **1994**, these are my headers for
one of the javascript files I want to server as static asset and cache it:

    Accept-Ranges:bytes
    Cache-Control:no-cache
    Connection:Keep-Alive
    Content-Encoding:gzip
    Content-Type:application/javascript
    Date:Fri, 29 May 2015 23:18:25 GMT
    ETag:W/"604348-1432950682000"
    Expires:Thu, 01 Dec 1994 16:00:00 GMT
    Keep-Alive:timeout=5, max=100
    Last-Modified:Fri, 29 May 2015 23:18:25 GMT
    Server:Apache
    Transfer-Encoding:chunked
    Vary:Accept-Encoding

Per the instructions I found on [this website][1] I tried to set it inside
my virtual host, like in the example below :

    <VirtualHost *:80>
        Alias /assets /opt/www/tomcat/webapps/ROOT/assets
        ServerName dev.myurl.com
        ServerAlias anotherone.myurl.com
        ErrorLog "|/opt/www/apache/2.2.25/bin/rotatelogs
/opt/www/logs/apache/app/_error_log-%Y-%m-%d-%H 86400"
        CustomLog "|/opt/www/apache/2.2.25/bin/rotatelogs
/opt/www/logs/apache/app/_access_log-%Y-%m-%d-%H 86400" common
        JkMount /* workerdev
    #---   Disabled Trace  -------
    RewriteEngine  On
    RewriteOptions inherit
    #----------------------------
    ExpiresActive On
    ExpiresByType application/x-javascript "now plus 1 months"
    </VirtualHost>

  [1]: http://www.simonwhatley.co.uk/how-to-set-an-expires-header-in-apache

This is my first time doing something like this, so I m not sure what else
do I need to do, and why is there this default `Expires`.
It has been like 9 or 10 hours of different experimenting and none of it
worked.
Any suggestions what else could I try?

**Additional details:**
It seems like that I'm able to add a http header or but can't override the
existing value, by adding this to the `VirtualHost`

    Header unset Cache-Control
    Header add Cache-Control "max-age=290304000, public"

    Header unset Expires
    Header add Expires "Thu, 01 Dec 2015 16:00:00 GMT"

I get this for the response headers :

    Cache-Control:no-cache
    Cache-Control:max-age=290304000, public
    Expires:Thu, 01 Dec 1994 16:00:00 GMT
    Expires:Thu, 01 Dec 2015 16:00:00 GMT

Very odd right? Where else could this header values be set from?

Mime
View raw message