Last active
December 22, 2025 19:07
-
-
Save ludndev/7f555ee74d7442df395e49e675a723b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| # ------------------------------------------------- | |
| # 1. Stop OPTIONS preflight HERE (NO redirect) | |
| # ------------------------------------------------- | |
| RewriteCond %{REQUEST_METHOD} OPTIONS | |
| RewriteRule ^ - [END] | |
| # ------------------------------------------------- | |
| # 2. Laravel Front Controller | |
| # ------------------------------------------------- | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^ index.php [L] | |
| </IfModule> | |
| <IfModule mod_headers.c> | |
| # ------------------------------------------------- | |
| # 3. CORS HEADERS (critical) | |
| # ------------------------------------------------- | |
| Header always set Access-Control-Allow-Origin "*" | |
| Header always set Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" | |
| Header always set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" | |
| Header always set Access-Control-Max-Age "86400" | |
| </IfModule> | |
| # ------------------------------------------------- | |
| # 4. Required for OPTIONS to return 204 | |
| # ------------------------------------------------- | |
| <IfModule mod_setenvif.c> | |
| SetEnvIf Request_Method OPTIONS is_preflight=1 | |
| </IfModule> | |
| <IfModule mod_headers.c> | |
| Header always set Content-Length "0" env=is_preflight | |
| Header always set Content-Type "text/plain; charset=UTF-8" env=is_preflight | |
| </IfModule> | |
| Options -Indexes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment