You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

75 lines
2.3 KiB

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule headers_module modules/mod_headers.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule dir_module modules/mod_dir.so
LoadModule deflate_module modules/mod_deflate.so
PidFile "/usr/local/apache2/logs/httpd.pid"
ErrorLog "/proc/self/fd/2"
CustomLog "/proc/self/fd/1" common
LogLevel info
Listen ${PORT}
ServerName localhost
DocumentRoot "/usr/local/apache2/htdocs"
DirectoryIndex index.html
User daemon
Group daemon
RewriteEngine On
RewriteRule ^/healthz$ /healthz.json [L]
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
# Allow direct access to index.html and existing files
RewriteRule ^index\.html$ - [L]
# If file exists, serve it
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . - [L]
# If directory exists, serve it (DirectoryIndex will handle it)
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
# Otherwise, serve 200.html for SPA routing
RewriteRule . /200.html [L]
</Directory>
<Location "/healthz.json">
Header set Content-Type "application/json"
Header set Cache-Control "public, max-age=5"
</Location>
<IfModule mod_headers.c>
Header set Service-Worker-Allowed "/"
# Cache static assets aggressively (they have hashed filenames)
<LocationMatch "^/_app/immutable/">
Header set Cache-Control "public, max-age=31536000, immutable"
</LocationMatch>
# Cache other static assets
<LocationMatch "\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|webp|avif)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</LocationMatch>
# Don't cache HTML files (they need to be fresh for updates)
<LocationMatch "\.html$">
Header set Cache-Control "no-cache, must-revalidate"
</LocationMatch>
</IfModule>
# Enable compression for text-based files
<IfModule mod_deflate.c>
<Location />
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|zip|gz|bz2|sit|rar|webp|avif)$ no-gzip dont-vary
</Location>
</IfModule>