javascriptapache.htaccesscachingmod-expires

Apache Mod Expires, how to Debug?


My objective: Have the javascript on my server ALWAYS pull from my server, and not allow caching.

My OS: Ubuntu

My Methods: (following https://www.digitalocean.com/community/tutorials/how-to-configure-apache-content-caching-on-ubuntu-14-04#setting-expires-and-caching-headers-on-content)

My results: No change at all in the HTTP headers. Users still complain that their cache files are out of date.

My .htaccess file, in it's entirety is:

    RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
ExpiresActive On
ExpiresByType text/javascript "access plus 1 seconds"
#ExpiresByType  text/js “access plus 1 seconds”

I know it's reading the .htaccess code because my maintenance mode code still works. I further know it's reading it because I fought with 500 Internal Server errors until I got my ExpiresByTypes syntax right.

How do I even BEGIN to debug this problem?


Solution

  • No HTTP response headers shown in the question, but Apache's default mime.types maps *.js to application/javascript not the text/javascript you're matching.

    application/javascript              js
    

    At the very least, duplicate your config for application/javascript!