support cors wildcard

This commit is contained in:
woodser 2021-08-20 14:17:51 -04:00
parent 82149bfe44
commit ec6b4cf9e1

View file

@ -668,7 +668,7 @@ namespace net_utils
// Cross-origin resource sharing // Cross-origin resource sharing
if(m_query_info.m_header_info.m_origin.size()) if(m_query_info.m_header_info.m_origin.size())
{ {
if (std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), m_query_info.m_header_info.m_origin)) if (std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), "*") || std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), m_query_info.m_header_info.m_origin))
{ {
buf += "Access-Control-Allow-Origin: "; buf += "Access-Control-Allow-Origin: ";
buf += m_query_info.m_header_info.m_origin; buf += m_query_info.m_header_info.m_origin;