Apache(ブラウザではない)が私のファイルをキャッシュしています。

Apache(ブラウザではない)が私のファイルをキャッシュしています。

ブラウザはそれをキャッシュしません。応答ヘッダーを取得します。

Accept-Ranges:bytes
Cache-Control:max-age=0, no-cache, no-store, must-revalidate
Connection:Keep-Alive
Content-Length:425169
Content-Type:application/javascript
Date:Thu, 09 Mar 2017 20:06:53 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Keep-Alive:timeout=5, max=100
Last-Modified:Thu, 09 Mar 2017 20:06:49 GMT
Pragma:no-cache
Server:Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.4.16

Apacheの私の設定:

<VirtualHost *:80>
    <Directory "/webapps/apps/devsite">
        Allow from all
        AllowOverride All
        Order allow,deny
    </Directory>
    DocumentRoot /webapps/apps/devsite
    ServerName testing.devsite.com
    SSLEngine off
</VirtualHost>

私の.htaccess:

<FilesMatch "\.(html|htm|js|css)$">
FileETag None
<IfModule mod_headers.c>
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>
</FilesMatch> 

以下は、キャッシュされていない新しいバージョンをロードします。

  1. サーバーで実行:rm -f /webapps/apps/devsite/scripts/script.js
  2. Webブラウザから再読み込み(したがって404が表示されます)
  3. ファイルをサーバーにコピーする
  4. ブラウザで更新

以下は、以前にキャッシュされたバージョンをロードします! :

  1. サーバーで実行:rm -f /webapps/apps/devsite/scripts/script.js
  2. ファイルをサーバーにコピーする注:まだブラウザをリロードしていません。)
  3. ブラウザで更新

これは、Apacheが新しい要求を受け取り、それが見つからなくなるまで何らかの方法でそれをキャッシュしていることを示します。なぜ?どうすれば解決できますか?

ベストアンサー1

問題は、カーネルのSendFileを使用して変更されたファイルを見逃すことです。以下を追加すると問題が解決します。

EnableSendfile off

(「ファイル」は小文字です)

http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile

おすすめ記事