Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下现在库里面有对http跨域请求的支持选项吗 #63

Open
berry0511 opened this issue Jan 4, 2024 · 1 comment
Open

Comments

@berry0511
Copy link

RT

@zhllxt
Copy link
Owner

zhllxt commented Jan 4, 2024

void set_cors(http::web_request& req, auto& res)
{
	if (m_config.enable_cors)
	{
		res.set("Access-Control-Allow-Headers", "x-requested-with,Content-Type,Authorization");
		res.set("Access-Control-Allow-Methods", "POST,GET");
		if (auto it = req.find(http::field::origin); it != req.end())
			res.set("Access-Control-Allow-Origin", it->value());
	}
}

上面是我用的一段示例代码,想直接设置一个选项就支持跨域的,没有这个功能

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants