apache2 css or js file exist but redirect to index

Viewed 32

My apache server is used for react application.

Server version: Apache/2.4.41 (Ubuntu) Server built: 2022-06-14T13:30:55

my index.html have these links for js and css :

static/js/2.661d9eb9.chunk.js static/js/main.29b2199b.chunk.js
static/css/2.af25cca9.chunk.css
static/css/main.8b985c6c.chunk.css
static/js/runtime-main.0b8371b1.js

i have verified via ssh connection and files are on the server at the good place when i go on the site, the index.html refer to good files but dont find static/css/main.8b985c6c.chunk.css when i try to go directly on the file by putting {{domain}}/static/css/main.8b985c6c.chunk.css the server send (redirect to index.html with .htaccess rules) and old index.html who refers to css file erased from the server and it works!

my .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, 12 Jan 1980 05:00:00 GMT"
  </IfModule>
</FilesMatch>

<IfModule mod_rewrite.c>
  RewriteBase /
  
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [END,NE,R=permanent]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . index.html [L]

  RewriteRule ^index\.html$ - [L]
  # RewriteRule ^index\.html$ maintenance.html [L]
  </IfModule>

i did this too

sudo rm -r /var/cache/apache2/mod_cache_disk/*

i've sotpped and restarted the server but nothing changed

and after 1 hour (i did nothing more) it works finally good

it is not the first time i have this problem and I'm anxious to deploy in prod server each time :/

someone can explain me the problem? thx

0 Answers
Related