Ajaxで外部URLにPOSTしようとしたらChromeで以下のエラー
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://domain' is therefore not allowed access.
サーバ側で以下のようにヘッダを追加する必要がある
$self->header_add( -access_control_allow_origin => 'https://domain', -access_control_allow_headers => 'Origin, X-Requested-With, Content-Type, Accept', );
Access-Control-Allow-Origin ヘッダは「https://*.domain」のようなワイルドカードが使えないようで、複数必要な場合はすべて記述する。
参考:
ajax - Error in chrome: Content-Type is not allowed by Access-Control-Allow-Headers - Stack Overflow
cors - Access-Control-Allow-Origin wildcard subdomains, ports and protocols - Stack Overflow