| @@ -5,6 +5,30 @@ | |||||
| RewriteEngine On | RewriteEngine On | ||||
| # 環境判定判定 | |||||
| SetEnvIf HOST "^.*easyreceipt.jp$" isProduction=yes | |||||
| SetEnvIf HOST "15.152.238.14" isStaging=yes | |||||
| SetEnvIf HOST "^localhost.*$" isLocal=yes | |||||
| # SSL強制 | |||||
| RewriteCond %{ENV:isProduction} yes | |||||
| RewriteCond %{HTTPS} off | |||||
| RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |||||
| # SSL強制のキャッシュ | |||||
| Header set "Strict-Transport-Security" "max-age=86400" env=isProduction | |||||
| Header unset X-Powered-By | |||||
| Header set "Content-Security-Policy" "default-src 'self';style-src 'self' 'unsafe-inline' fonts.googleapis.com;img-src 'self' data: api.iconify.design;font-src 'self' fonts.gstatic.com;frame-ancestors 'none';form-action 'self';connect-src 'self' https:" env=isProduction | |||||
| Header set "Content-Security-Policy" "default-src 'self';style-src 'self' 'unsafe-inline' fonts.googleapis.com;img-src 'self' data: api.iconify.design;font-src 'self' fonts.gstatic.com;frame-ancestors 'none';form-action 'self';connect-src 'self' https:" env=isStaging | |||||
| Header set "X-Frame-Options" "deny" env=isProduction | |||||
| Header set "X-Frame-Options" "deny" env=isStaging | |||||
| Header set "Cache-Control" "no-cache, no-store, must-revalidate" | |||||
| # Handle Authorization Header | # Handle Authorization Header | ||||
| RewriteCond %{HTTP:Authorization} . | RewriteCond %{HTTP:Authorization} . | ||||
| RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | ||||
| @@ -18,4 +42,18 @@ | |||||
| RewriteCond %{REQUEST_FILENAME} !-d | RewriteCond %{REQUEST_FILENAME} !-d | ||||
| RewriteCond %{REQUEST_FILENAME} !-f | RewriteCond %{REQUEST_FILENAME} !-f | ||||
| RewriteRule ^ index.php [L] | RewriteRule ^ index.php [L] | ||||
| # 以下、ファイルアクセス | |||||
| # リソース判定 | |||||
| SetEnvIf Request_URI "^\/static\/js\/.+\.js$" isJsFile=yes | |||||
| SetEnvIf Request_URI "^\/static\/css\/.+\.css$" isCssFile=yes | |||||
| SetEnvIf Request_URI "^\/fonts\/.+$" isFontFile=yes | |||||
| Header set "Cache-Control" "private, no-cache" env=isJsFile | |||||
| Header set "Cache-Control" "private, no-cache" env=isCssFile | |||||
| Header set "Cache-Control" "private, no-cache" env=isFontFile | |||||
| Header set "X-Content-Type-Options" "nosniff" env=isProduction | |||||
| Header set "X-Content-Type-Options" "nosniff" env=isStaging | |||||
| </IfModule> | </IfModule> | ||||