Merge pull request #2830

f5461a6a RPC: CORS add Access-Control-Allow-Headers to OPTIONS preflight (Tim L)
This commit is contained in:
Riccardo Spagni 2017-12-02 09:22:17 +02:00
commit 0d7162dc10
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

View File

@ -639,6 +639,9 @@ namespace net_utils
buf += "Access-Control-Allow-Origin: ";
buf += m_query_info.m_header_info.m_origin;
buf += "\r\n";
buf += "Access-Control-Expose-Headers: www-authenticate\r\n";
if (m_query_info.m_http_method == http::http_method_options)
buf += "Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With\r\n";
buf += "Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS\r\n";
}
}