Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running apache2 on Ubuntu. I want to set expiration header like this.

ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|png|js|css)$">
  ExpiresDefault "access plus 1 year"
</FilesMatch>

I understang that it will cache a url like www.example.com/images/a.gif for one year.

My question is what about url like this. www.example.com/javascripts/all.js?123456 . Assuming that the above url is cached. Now if I change the url to www.example.com/javascripts/all.js?abcdef will browser request for new js file?

Basically I am trying to find while caching does browser take into account full url including the data after the question mark.

Also my current vhost configuration looks like this

<VirtualHost xx.xx.xx.xx:80>
  ServerName xxxx
  ServerAlias xxxxx
  DocumentRoot /home/xxx/current/public
  <Directory "/home/xxxx/current/public">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
  </Directory>
  <Location />
    # Insert filter
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    # Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

  </Location> 
</VirtualHost>

I am assuming that I can put ExpiresActive On and other statements just before tag begins.

share|improve this question

1 Answer 1

It's ok. According to your configuration all.js?123456 will request a new version of all.js . Also you can put ExpiresActiveOn inside a virtual host or directory .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.