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. 웹 브라우저에서 다시 로드(따라서 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

관련 정보