cors : flutter on web

omohikane.com

PHPだけでRESTAPIを再現してみた - Qiita

qiita.com

qiita.com

OPTIONSがきたら、Access-Control-Request-Methodを取得で良いのか?

AddType application/x-httpd-php .php .html .htm

RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

Header always set Access-Control-Allow-Methods: "GET, POST, OPTIONS"
Header always set Access-Control-Allow-Origin: "*"
Header always set allow: "OPTIONS, GET, HEAD, POST"
λ curl -H "Origin: https://localhost" -H "Access-Control-Request-Method: POST" -H "Access-Control-Request-Headers: X-Requested-With" -X OPTIONS -v https://test.niko.com/v1/login.php -d '{"user_id ":"0612","password":"0612"}'
/* -----codeの行番号----- */